Author: jmcd
Date: 2007-05-21 16:01:22 +0000 (Mon, 21 May 2007)
New Revision: 23041

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23041

Log:
Remainder of fix for 4630: fix special case of unix_to_nt_time() for
TIME_T_MAX, and also display of it in http_timestring()

Modified:
   branches/SAMBA_3_0/source/lib/time.c
   branches/SAMBA_3_0_25/source/lib/time.c
   branches/SAMBA_3_0_26/source/lib/time.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0/source/lib/time.c        2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0/source/lib/time.c        2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
        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 @@
        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

Modified: branches/SAMBA_3_0_25/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0_25/source/lib/time.c     2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0_25/source/lib/time.c     2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
        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 @@
        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

Modified: branches/SAMBA_3_0_26/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0_26/source/lib/time.c     2007-05-21 15:58:27 UTC (rev 
23040)
+++ branches/SAMBA_3_0_26/source/lib/time.c     2007-05-21 16:01:22 UTC (rev 
23041)
@@ -95,7 +95,13 @@
        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 @@
        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

Reply via email to