time fix
authorClaus Gittinger <cg@exept.de>
Fri, 07 Nov 2014 13:23:34 +0100
changeset 16965 4c78b5c5ea44
parent 16964 965ecd9a40b6
child 16966 7d549c75105f
time fix
UnixOperatingSystem.st
--- a/UnixOperatingSystem.st	Fri Nov 07 13:22:47 2014 +0100
+++ b/UnixOperatingSystem.st	Fri Nov 07 13:23:34 2014 +0100
@@ -9260,7 +9260,7 @@
     "
 !
 
-computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millisecond:millis
+computeOSTimeFromYear:y month:m day:d hour:h minute:min second:s millisecond:millis
     "return the OS-dependent time for the given time and day.
      The arguments are assumed to be in localtime including
      any daylight saving adjustings."
@@ -9577,66 +9577,66 @@
     time_t tt = __signedLongIntVal(osSeconds);
 
     if (tt == 0 && !__isSmallInteger(osSeconds))
-        goto out;             // __singedLongIntVal() returns 0 on failure
+	goto out;             // __singedLongIntVal() returns 0 on failure
 
     /* try cache */
     {
-        OBJ lastSeconds = @global(LastTimeInfoSeconds);
-
-        if (__isInteger(lastSeconds)
-             && (__signedLongIntVal(lastSeconds) == tt)
-             && (@global(LastTimeInfoIsLocal) == isLocalTime)
-        ) {
-            OBJ lastTimeInfo = @global(LastTimeInfo);
-            if (lastTimeInfo != nil) {
-                info = lastTimeInfo;
-                goto out;
-            }
-        }
+	OBJ lastSeconds = @global(LastTimeInfoSeconds);
+
+	if (__isInteger(lastSeconds)
+	     && (__signedLongIntVal(lastSeconds) == tt)
+	     && (@global(LastTimeInfoIsLocal) == isLocalTime)
+	) {
+	    OBJ lastTimeInfo = @global(LastTimeInfo);
+	    if (lastTimeInfo != nil) {
+		info = lastTimeInfo;
+		goto out;
+	    }
+	}
     }
 
     result = (isLocalTime == true) ? localtime_r(&tt, &tmValue) :  gmtime_r(&tt, &tmValue);
     if (result != NULL) {
-        hours = __mkSmallInteger(tmValue.tm_hour);
-        minutes = __mkSmallInteger(tmValue.tm_min);
-        seconds = __mkSmallInteger(tmValue.tm_sec);
-
-        year = __mkSmallInteger(tmValue.tm_year + 1900);
-        month = __mkSmallInteger(tmValue.tm_mon + 1);
-        day = __mkSmallInteger(tmValue.tm_mday);
-
-        yDay = __mkSmallInteger(tmValue.tm_yday+1);
-        wDay = __mkSmallInteger(tmValue.tm_wday == 0 ? 7 : tmValue.tm_wday);
-        utcOffset = __mkSmallInteger(TIMEZONE(&tmValue));
-        dst = (tmValue.tm_isdst == 0 ? false : true);
+	hours = __mkSmallInteger(tmValue.tm_hour);
+	minutes = __mkSmallInteger(tmValue.tm_min);
+	seconds = __mkSmallInteger(tmValue.tm_sec);
+
+	year = __mkSmallInteger(tmValue.tm_year + 1900);
+	month = __mkSmallInteger(tmValue.tm_mon + 1);
+	day = __mkSmallInteger(tmValue.tm_mday);
+
+	yDay = __mkSmallInteger(tmValue.tm_yday+1);
+	wDay = __mkSmallInteger(tmValue.tm_wday == 0 ? 7 : tmValue.tm_wday);
+	utcOffset = __mkSmallInteger(TIMEZONE(&tmValue));
+	dst = (tmValue.tm_isdst == 0 ? false : true);
     }
 out:;
 %}.
     info notNil ifTrue:[
-        "there is a matching cached value"
-        LastTimeInfoMilliseconds == osMilliseconds ifTrue:[
-            ^ info.
-        ].
-        info := info copy.
-        info milliseconds:osMilliseconds.
+	"there is a matching cached value"
+	LastTimeInfoMilliseconds == osMilliseconds ifTrue:[
+	    ^ info.
+	].
+	info := info copy.
+	info milliseconds:osMilliseconds.
     ] ifFalse:[
-        year isNil ifTrue:[
-            TimeConversionError raiseErrorString:' - out of range'.
-        ].
-
-        info := self timeInfoClass new.
-        info
-            year:year
-            month:month
-            day:day
-            hours:hours
-            minutes:minutes
-            seconds:seconds
-            milliseconds:osMilliseconds
-            utcOffset:utcOffset
-            dst:dst
-            dayInYear:yDay
-            dayInWeek:wDay.
+	year isNil ifTrue:[
+	    TimeConversionError raiseErrorString:' - out of range'.
+	].
+
+	info := self timeInfoClass new.
+	info
+	    year:year
+	    month:month
+	    day:day
+	    hours:hours
+	    minutes:minutes
+	    seconds:seconds
+	    milliseconds:osMilliseconds
+	    utcOffset:utcOffset
+	    dst:dst
+	    dayInYear:yDay
+	    dayInWeek:wDay.
     ].
 
 %{
@@ -13519,11 +13519,11 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.387 2014-11-07 00:02:36 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.388 2014-11-07 12:23:34 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.387 2014-11-07 00:02:36 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.388 2014-11-07 12:23:34 cg Exp $'
 ! !