]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Replace "%T" as format string to strftime
authorRod Widdowson <rdw@steadingsoftware.com>
Tue, 6 Sep 2011 14:23:33 +0000 (15:23 +0100)
committerJeffrey Altman <jaltman@openafs.org>
Tue, 6 Sep 2011 20:50:41 +0000 (13:50 -0700)
Checkin I18ed36cc4dce9aa354ad1398710ab7db83c814a2 made strftime
much more widespread.  However the %T format is not available on
all platforms and causes (at least) Windows servers to fail on
first attempt to log.  %T is just shorthand to %H:%M:%S so this
checkin just replaces the one with the other.

Change-Id: Ibfff133d9263f5513276d96f3624801fd8ab229e
Reviewed-on: http://gerrit.openafs.org/5364
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
src/audit/audit.c
src/butc/lwps.c
src/util/assert.c
src/util/serverLog.c
src/viced/host.c
src/viced/viced.c
src/vlserver/vlclient.c

index de73c6f372e02a95722aca29c0b2d237160384e3..2c45aeb586c5723d8d8792d03cf93fc393b3535c 100644 (file)
@@ -176,7 +176,7 @@ printbuf(int rec, char *audEvent, char *afsName, afs_int32 hostId,
     /* Don't print the timestamp or thread id if we recursed */
     if (rec == 0) {
        currenttime = time(0);
-       if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y ",
+       if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y ",
                     localtime_r(&currenttime, &tm)) !=0)
            audit_ops->append_msg(tbuffer);
 
index f479b78ab6eb95a3bba36d39ce1e2de5b8c1f9ae..0383ec850c5ab8ee75dde189d764e7abd9c76776 100644 (file)
@@ -198,7 +198,7 @@ TapeLogStr(int debug, afs_int32 task, afs_int32 error1, afs_int32 error2,
     struct tm tm;
 
     now = time(0);
-    if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
                 localtime_r(&now, &tm)) != 0)
        fprintf(logIO, "%s: ", tbuffer);
 
@@ -255,7 +255,7 @@ ErrorLogStr(int debug, afs_int32 task, afs_int32 error1, afs_int32 error2,
     struct tm tm;
 
     now = time(0);
-    if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    if (strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
                 localtime_r(&now, &tm)) != 0)
        fprintf(ErrorlogIO, "%s: ", tbuffer);
 
index 78e9d0ce57887fbc02c9867789802ae1b845c91a..197e1fdbf0d8cf9cbdf5e0aa34779e0987acd98e 100644 (file)
@@ -33,7 +33,7 @@ AssertionFailed(char *file, int line)
     struct tm tm;
 
     when = time(NULL);
-    strftime(tdate, sizeof(tdate), "%a %b %d %T %Y",
+    strftime(tdate, sizeof(tdate), "%a %b %d %H:%M:%S %Y",
             localtime_r(&when, &tm));
     fprintf(stderr, "%s Assertion failed! file %s, line %d.\n", tdate, file,
            line);
index 77f069eb17dab013e6f6bf4098bc6128af3aae5e..7c5eae167afc7ec18d95c30e1cd3ee527f6c67b3 100644 (file)
@@ -107,7 +107,7 @@ vFSLog(const char *format, va_list args)
     int num;
 
     currenttime = time(NULL);
-    len = strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y ",
+    len = strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y ",
                   localtime_r(&currenttime, &tm));
     info = &tbuffer[len];
 
index 063006744431e1c695cbaccd38b9ff9b84e158e6..ac9ec9c1b8858e5c6e8744665fc16a413b236804 100644 (file)
@@ -2757,7 +2757,7 @@ h_PrintClient(struct host *host, void *rock)
        H_UNLOCK;
        return 0;
     }
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&LastCall, &tm));
     snprintf(tmpStr, sizeof tmpStr, "Host %s:%d down = %d, LastCall %s\n",
             afs_inet_ntoa_r(host->host, hoststr),
@@ -2767,7 +2767,7 @@ h_PrintClient(struct host *host, void *rock)
     for (client = host->FirstClient; client; client = client->next) {
        if (!client->deleted) {
            expTime = client->expTime;
-           strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+           strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
                     localtime_r(&expTime, &tm));
            snprintf(tmpStr, sizeof tmpStr,
                     "    user id=%d,  name=%s, sl=%s till %s\n",
@@ -2818,7 +2818,7 @@ h_PrintClients(void)
        return;
     }
     now = FT_ApproxTime();
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&now, &tm));
     snprintf(tmpStr, sizeof tmpStr, "List of active users at %s\n\n",
             tbuffer);
@@ -2892,7 +2892,7 @@ h_DumpHosts(void)
        return;
     }
     now = FT_ApproxTime();
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&now, &tm));
     snprintf(tmpStr, sizeof tmpStr, "List of active hosts at %s\n\n", tbuffer);
     (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
index b36c2ea8435c8ad2f6ba71fd611765172f87dc3a..ce77ccedc6b566632abbc0bc1fdfeee70e7b2d36 100644 (file)
@@ -464,7 +464,7 @@ FiveMinuteCheckLWP(void *unused)
        if (printBanner && (++msg & 1)) {       /* Every 10 minutes */
            time_t now = FT_ApproxTime();
            struct tm tm;
-           strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+           strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
                     localtime_r(&now, &tm));
            ViceLog(2,
                    ("File server is running at %s\n", tbuffer));
@@ -687,7 +687,7 @@ PrintCounters(void)
 
     FT_GetTimeOfDay(&tpl, 0);
     Statistics = 1;
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&StartTime, &tm));
     ViceLog(0, ("Vice was last started at %s\n", tbuffer));
 
@@ -802,7 +802,7 @@ ShutDownAndCore(int dopanic)
     FS_STATE_UNLOCK;
 #endif
 
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&now, &tm));
     ViceLog(0, ("Shutting down file server at %s\n", tbuffer));
     if (dopanic)
@@ -852,7 +852,7 @@ ShutDownAndCore(int dopanic)
        fflush(debugFile);
     }
     now = time(0);
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&now, &tm));
     if (dopanic) {
       ViceLog(0, ("File server has terminated abnormally at %s\n", tbuffer));
@@ -2311,7 +2311,7 @@ main(int argc, char *argv[])
     }
 
     t = tp.tv_sec;
-    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %T %Y",
+    strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
             localtime_r(&t, &tm));
     ViceLog(0, ("File Server started %s\n", tbuffer));
 #if FS_STATS_DETAILED
index 4860c00602a85557926954689bfc1757a7144a81..1ba73387f8bf8da5b86210786b17f698278b3f3e 100644 (file)
@@ -1276,7 +1276,7 @@ dump_stats(vldstats *stats, vital_vlheader *vital_header)
     time_t start_time = stats->start_time;
     struct tm tm;
 
-    strftime(strg, sizeof(strg), "%a %b %d %T %Y",
+    strftime(strg, sizeof(strg), "%a %b %d %H:%M:%S %Y",
             localtime_r(&start_time, &tm));
     printf("Dynamic statistics stats (starting time: %s):\n", strg);
     printf("OpcodeName\t# Requests\t# Aborts\n");