mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 23:10:40 +00:00
ICU-6098 move getCurrentYear into toolutil
X-SVN-Rev: 23949
This commit is contained in:
parent
297a478ee0
commit
823e58911b
3 changed files with 27 additions and 14 deletions
|
@ -23,12 +23,12 @@
|
|||
#include "unicode/uclean.h"
|
||||
#include "unicode/udata.h"
|
||||
#include "unicode/udbgutil.h"
|
||||
#include "unicode/ucal.h"
|
||||
#include "unewdata.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "uoptions.h"
|
||||
#include "gentest.h"
|
||||
#include "toolutil.h"
|
||||
|
||||
#define DATA_NAME "test"
|
||||
#define DATA_TYPE "icu"
|
||||
|
@ -138,22 +138,12 @@ createData(const char* outputDirectory, UErrorCode *errorCode) {
|
|||
|
||||
/* Create Java file ----------------------------------------------------- */
|
||||
|
||||
int getCurrentYear() {
|
||||
UErrorCode status=U_ZERO_ERROR;
|
||||
int year = 0;
|
||||
UCalendar *cal = ucal_open(NULL, -1, NULL, UCAL_TRADITIONAL, &status);
|
||||
ucal_setMillis(cal, ucal_getNow(), &status);
|
||||
year = ucal_get(cal, UCAL_YEAR, &status);
|
||||
ucal_close(cal);
|
||||
return year;
|
||||
}
|
||||
|
||||
static int
|
||||
outputJavaStuff(const char* progname, const char *outputDir) {
|
||||
int32_t i,t,count;
|
||||
char file[512];
|
||||
FILE *out;
|
||||
int year = getCurrentYear();
|
||||
int32_t year = getCurrentYear();
|
||||
|
||||
uprv_strcpy(file,outputDir);
|
||||
if(*outputDir && /* don't put a trailing slash if outputDir is empty */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2007, International Business Machines
|
||||
* Copyright (C) 1999-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "toolutil.h"
|
||||
#include "unicode/ucal.h"
|
||||
|
||||
#ifdef U_WINDOWS
|
||||
# define VC_EXTRALEAN
|
||||
|
@ -38,6 +39,22 @@
|
|||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
static int32_t currentYear = -1;
|
||||
|
||||
U_CAPI int32_t U_EXPORT2 getCurrentYear() {
|
||||
UErrorCode status=U_ZERO_ERROR;
|
||||
UCalendar *cal = NULL;
|
||||
|
||||
if(currentYear == -1) {
|
||||
cal = ucal_open(NULL, -1, NULL, UCAL_TRADITIONAL, &status);
|
||||
ucal_setMillis(cal, ucal_getNow(), &status);
|
||||
currentYear = ucal_get(cal, UCAL_YEAR, &status);
|
||||
ucal_close(cal);
|
||||
}
|
||||
return currentYear;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
getLongPathname(const char *pathname) {
|
||||
#ifdef U_WINDOWS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2005, International Business Machines
|
||||
* Copyright (C) 1999-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -49,6 +49,12 @@ getLongPathname(const char *pathname);
|
|||
U_CAPI const char * U_EXPORT2
|
||||
findBasename(const char *filename);
|
||||
|
||||
/*
|
||||
* Return the current year in the Gregorian calendar. Used for copyright generation.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
getCurrentYear(void);
|
||||
|
||||
/*
|
||||
* Creates a diretory with pathname.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue