Tcl Source Code

Artifact [329d04ce66]
Login

Artifact 329d04ce66669e191370e05bdcb51d77185f7882:

Attachment "diff.#413397" to ticket [414024ffff] added by hemanglavana 2001-04-05 22:06:06.
godel:14> cvs diff -c tclDate.c tclGetDate.y
Index: tclDate.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDate.c,v
retrieving revision 1.18
diff -c -r1.18 tclDate.c
*** tclDate.c	2000/05/18 22:29:56	1.18
--- tclDate.c	2001/04/05 14:50:57
***************
*** 579,584 ****
--- 579,596 ----
      result = Convert(Month, (time_t) tm->tm_mday, Year,
  	    (time_t) tm->tm_hour, (time_t) tm->tm_min, (time_t) tm->tm_sec,
  	    MER24, DSTmaybe, &Julian);
+     /* The Julian time returned above is behind by one day, if "month"
+      * or "year" is used to specify relative time and the GMT flag is true.
+      * This problem occurs only when the current time is closer to
+      * midnight, the difference being not more than its time difference
+      * with GMT. For example, in US/Pacific time zone, the problem occurs
+      * whenever the current time is between midnight to 8:00am or 7:00amDST.
+      * See Bug# 413397 for more details and sample script.
+      * To resolve this bug, we simply add the number of seconds corresponding
+      * to timezone difference with GMT to Julian time, if GMT flag is true.
+      */
+     if (TclDateTimezone == 0)
+         Julian += TclpGetTimeZone((unsigned long) Start) * 60L;
      /*
       * The following iteration takes into account the case were we jump
       * into a "short month".  Far example, "one month from Jan 31" will
Index: tclGetDate.y
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclGetDate.y,v
retrieving revision 1.16
diff -c -r1.16 tclGetDate.y
*** tclGetDate.y	2000/05/18 22:29:56	1.16
--- tclGetDate.y	2001/04/05 14:50:57
***************
*** 798,803 ****
--- 798,815 ----
      result = Convert(Month, (time_t) tm->tm_mday, Year,
  	    (time_t) tm->tm_hour, (time_t) tm->tm_min, (time_t) tm->tm_sec,
  	    MER24, DSTmaybe, &Julian);
+     /* The Julian time returned above is behind by one day, if "month" 
+      * or "year" is used to specify relative time and the GMT flag is true.
+      * This problem occurs only when the current time is closer to
+      * midnight, the difference being not more than its time difference
+      * with GMT. For example, in US/Pacific time zone, the problem occurs
+      * whenever the current time is between midnight to 8:00am or 7:00amDST.
+      * See Bug# 413397 for more details and sample script.
+      * To resolve this bug, we simply add the number of seconds corresponding
+      * to timezone difference with GMT to Julian time, if GMT flag is true.
+      */
+     if (TclDateTimezone == 0) 
+         Julian += TclpGetTimeZone((unsigned long) Start) * 60L;
      /*
       * The following iteration takes into account the case were we jump
       * into a "short month".  Far example, "one month from Jan 31" will