r23041: Remainder of fix for 4630: fix special case of unix_to_nt_time() for
authorJim McDonough <jmcd@samba.org>
Mon, 21 May 2007 16:01:22 +0000 (16:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:16 +0000 (12:22 -0500)
TIME_T_MAX, and also display of it in http_timestring()
(This used to be commit 2553b6a56d20ef6273001ae3b090e156e676592c)

source3/lib/time.c

index ae7f97790d425afd4ee8b9b610e1795315a3a415..ee44f5eb1349980bf2dcf9d9ee1256def3a23e07 100644 (file)
@@ -95,7 +95,13 @@ void unix_to_nt_time(NTTIME *nt, time_t t)
        if (t == (time_t)-1) {
                *nt = (NTTIME)-1LL;
                return;
-       }               
+       }       
+
+       if (t == TIME_T_MAX) {
+               *nt = 0x7fffffffffffffffLL;
+               return;
+       }
+
        if (t == 0) {
                *nt = 0;
                return;
@@ -301,7 +307,9 @@ char *http_timestring(time_t t)
        static fstring buf;
        struct tm *tm = localtime(&t);
 
-       if (!tm) {
+       if (t == TIME_T_MAX) {
+               slprintf(buf,sizeof(buf)-1,"never");
+       } else if (!tm) {
                slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
        } else {
 #ifndef HAVE_STRFTIME