X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/fd0068a84e9996f225edba706498f6ed413d0673..46f4442e9a5a4f3b98b7c1083586332f6a8a99a4:/icuSources/tools/toolutil/toolutil.c diff --git a/icuSources/tools/toolutil/toolutil.c b/icuSources/tools/toolutil/toolutil.c index 3ee34e98..071eac7f 100644 --- a/icuSources/tools/toolutil/toolutil.c +++ b/icuSources/tools/toolutil/toolutil.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2005, 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,12 +39,32 @@ #endif #include +static int32_t currentYear = -1; + +U_CAPI int32_t U_EXPORT2 getCurrentYear() { +#if !UCONFIG_NO_FORMATTING + 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; +#else + return 2008; +#endif +} + + U_CAPI const char * U_EXPORT2 getLongPathname(const char *pathname) { #ifdef U_WINDOWS /* anticipate problems with "short" pathnames */ static WIN32_FIND_DATA info; - HANDLE file=FindFirstFile(pathname, &info); + HANDLE file=FindFirstFileA(pathname, &info); if(file!=INVALID_HANDLE_VALUE) { if(info.cAlternateFileName[0]!=0) { /* this file has a short name, get and use the long one */