AbstractOperatingSystem.st
changeset 8565 6c5af0dd0269
parent 8505 4456ffd20005
child 8587 6d079a8fb5aa
--- a/AbstractOperatingSystem.st	Tue Sep 21 19:52:44 2004 +0200
+++ b/AbstractOperatingSystem.st	Tue Sep 21 19:54:54 2004 +0200
@@ -4733,6 +4733,27 @@
 
 !AbstractOperatingSystem class methodsFor:'time and date'!
 
+computeDatePartsOf:osTime for:aBlock
+    "compute year, month and day from the OS time, osTime
+     and evaluate the argument, a 3-arg block with these.
+     Conversion is to localtime including any daylight saving adjustments."
+
+    <resource:#obsolete>
+
+    |i|
+
+    self obsoleteMethodWarning:'use #computeTimeAndDateFrom:osTime'.
+
+    i := self computeTimeAndDateFrom:osTime.
+    aBlock value:i year value:i month value:i day
+
+    "
+     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
+        y printCR. m printCR. d printCR
+     ]
+    "
+!
+
 computeOSTimeFromUTCYear: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 UTC Time"
@@ -4769,6 +4790,32 @@
     "
 !
 
+computeTimePartsOf:osTime for:aBlock
+    "compute hours, minutes, seconds and milliseconds from the local osTime
+     and evaluate the argument, a 4-arg block with these.
+     Conversion is to localtime including any daylight saving adjustments."
+
+    <resource:#obsolete>
+
+    |hours minutes seconds millis i|
+
+    self obsoleteMethodWarning:'use #computeTimeAndDateFrom:osTime'.
+
+    i := self computeTimeAndDateFrom:osTime.
+    hours := i hours.
+    minutes := i minutes.
+    seconds := i seconds.
+    millis := i milliseconds.
+
+    aBlock value:hours value:minutes value:seconds value:millis
+
+    "
+     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
+        Transcript show:h; space; show:m; space; show:s; space; showCR:milli.
+     ]
+    "
+!
+
 computeUTCTimeAndDateFrom:osTime
     "given an OS-dependent time in osTime, return an Array
      containing:
@@ -4798,11 +4845,23 @@
 !
 
 computeUTCTimePartsOf:osTime for:aBlock
-    "compute hours, minutes, seconds and milliseconds from the osTime 
+    "compute hours, minutes, seconds and milliseconds from the osTime
      and evaluate the argument, a 4-arg block with these.
      Conversion is to UTC."
 
-    self subclassResponsibility
+    <resource:#obsolete>
+
+    |hours minutes seconds millis i|
+
+    self obsoleteMethodWarning:'use #computeTimeAndDateFrom:osTime'.
+
+    i := self computeUTCTimeAndDateFrom:osTime.
+    hours := i hours.
+    minutes := i minutes.
+    seconds := i seconds.
+    millis := i milliseconds.
+
+    aBlock value:hours value:minutes value:seconds value:millis
 !
 
 getMicrosecondTime
@@ -5497,7 +5556,7 @@
 !AbstractOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.133 2004-08-31 14:26:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.134 2004-09-21 17:54:54 stefan Exp $'
 ! !
 
 AbstractOperatingSystem initialize!