*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 25 Jul 2003 22:13:35 +0200
changeset 7533 3d6e54708528
parent 7532 7612ff7ef377
child 7534 9cc58f3d3469
*** empty log message ***
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Fri Jul 25 22:00:45 2003 +0200
+++ b/Win32OperatingSystem.st	Fri Jul 25 22:13:35 2003 +0200
@@ -6325,6 +6325,70 @@
 
 !
 
+timeInfoFromSeconds:osSeconds localTime:isLocalTime
+    "return a timeInfo structure containing values for the given
+     OS-second value.
+     An internal helper"
+
+    |low hi year month day hours minutes seconds millis utcOffset 
+     dst yDay wDay osSeconds info|
+
+    millis := osTime \\ 1000.
+    osSeconds := osTime // 1000.
+%{
+    struct tm *tmPtr;
+    struct tm *gmTmPtr;
+    INT t;
+    TIME_T tt;
+
+    t = __longIntVal(osSeconds);
+    tt = (TIME_T)t;
+
+    tmPtr = localtime(&tt);
+    hours = __MKSMALLINT(tmPtr->tm_hour);
+    minutes = __MKSMALLINT(tmPtr->tm_min);
+    seconds = __MKSMALLINT(tmPtr->tm_sec);
+
+    year = __MKSMALLINT(tmPtr->tm_year + 1900);
+    month = __MKSMALLINT(tmPtr->tm_mon + 1);
+    day = __MKSMALLINT(tmPtr->tm_mday);
+
+    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
+    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
+
+    if (tmPtr->tm_isdst == 0) {
+	dst = false;
+	utcOffset = __MKINT(TIMEZONE(tmPtr));
+    } else {
+	dst = true;
+#ifdef HAS_ALTZONE
+	utcOffset = __MKINT(altzone);
+#else
+	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
+#endif
+    }
+%}.
+    info := self timeInfoClass new.
+
+    info
+	year:year
+	month:month
+	day:day
+	hours:hours
+	minutes:minutes
+	seconds:seconds
+	utcOffset:utcOffset
+	dst:dst
+	dayInYear:yDay
+	dayInWeek:wDay.
+	info milliseconds:millis.
+    ^ info
+
+    "
+     OperatingSystem timeInfoFromSeconds:0 localTime:false
+    "
+!
+
 computeTimeAndDateFrom:osTime
     "given an OS-dependent time in osTime, return an Array
      containing (full-) year, month, day, hour, minute and seconds,
@@ -8828,7 +8892,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.129 2003-07-25 19:29:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.130 2003-07-25 20:13:35 cg Exp $'
 ! !
 
 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
@@ -8855,7 +8919,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.129 2003-07-25 19:29:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.130 2003-07-25 20:13:35 cg Exp $'
 ! !
 
 !Win32OperatingSystem::Win32Handle methodsFor:'io'!
@@ -9242,7 +9306,7 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.129 2003-07-25 19:29:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.130 2003-07-25 20:13:35 cg Exp $'
 ! !
 
 Win32OperatingSystem initialize!