]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/tools/toolutil/toolutil.c
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / tools / toolutil / toolutil.c
index 3ee34e983f34a386b12fb5b3c2f6231a5597bd11..071eac7f57cb9f3eeb513a3213878177a90c7cc4 100644 (file)
@@ -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
 #endif
 #include <errno.h>
 
+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 */