tuning printRFC1123FormatOn
authorpenk
Tue, 04 Nov 2003 12:10:50 +0100
changeset 7734 650ececb37bb
parent 7733 f556d689cf53
child 7735 9e0da6630d80
tuning printRFC1123FormatOn accessor for time info needed
AbsoluteTime.st
Timestamp.st
--- a/AbsoluteTime.st	Mon Nov 03 17:41:46 2003 +0100
+++ b/AbsoluteTime.st	Tue Nov 04 12:10:50 2003 +0100
@@ -746,6 +746,10 @@
     "Modified: 2.7.1996 / 09:20:54 / cg"
 !
 
+timeInfo
+    ^ (OperatingSystem computeTimeAndDateFrom:osTime)
+!
+
 utcOffset
     "return the difference between UTC (Greenwich Mean Time) and the local time
      if daylight saving time applies to ourself, take that into account.
@@ -1086,34 +1090,35 @@
 "/                      | "May" | "Jun" | "Jul" | "Aug"
 "/                      | "Sep" | "Oct" | "Nov" | "Dec"
 
-    |meUTC|
+    |meUTC timeInfo|
 
     meUTC := AbsoluteTime fromSeconds:((self asSeconds) + (self utcOffset)).
+    timeInfo := meUTC timeInfo.
 
-    aStream nextPutAll:(#('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') at:meUTC dayInWeek);
+    aStream nextPutAll:(#('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') at:timeInfo dayInWeek);
             nextPutAll:', '.
-    meUTC day printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo day printOn:aStream leftPaddedTo:2 with:$0.
     aStream space.
-    aStream nextPutAll:(#('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec') at:meUTC month).
+    aStream nextPutAll:(#('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec') at:timeInfo month).
 
 "/ The following line is wrong, because the names are printed in the current locale!!
-"/    meUTC printOn:aStream format:'%(ShortDayName), %(day) %(ShortMonthName) %y %h:%m:%s GMT'. 
+"/    timeInfo printOn:aStream format:'%(ShortDayName), %(day) %(ShortMonthName) %y %h:%m:%s GMT'. 
 
 "/ the following is too slow for heavy use    
-"/    meUTC printOn:aStream format:' %y %h:%m:%s GMT'. 
+"/    timeInfo printOn:aStream format:' %y %h:%m:%s GMT'. 
 
     aStream nextPut:Character space.
-    meUTC year printOn:aStream.
+    timeInfo year printOn:aStream.
     aStream nextPut:Character space.
-    meUTC hour printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo hours printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPut:$:.
-    meUTC minute printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo minutes printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPut:$:.
-    meUTC second printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo seconds printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPutAll:' GMT'.
 
     "
-     AbsoluteTime now printRFC1123FormatOn:Transcript
+     AbsoluteTime now printRFC1123FormatOn:Transcript   
     "
 !
 
@@ -1208,5 +1213,5 @@
 !AbsoluteTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.84 2003-11-03 16:39:54 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.85 2003-11-04 11:10:50 penk Exp $'
 ! !
--- a/Timestamp.st	Mon Nov 03 17:41:46 2003 +0100
+++ b/Timestamp.st	Tue Nov 04 12:10:50 2003 +0100
@@ -746,6 +746,10 @@
     "Modified: 2.7.1996 / 09:20:54 / cg"
 !
 
+timeInfo
+    ^ (OperatingSystem computeTimeAndDateFrom:osTime)
+!
+
 utcOffset
     "return the difference between UTC (Greenwich Mean Time) and the local time
      if daylight saving time applies to ourself, take that into account.
@@ -1086,34 +1090,35 @@
 "/                      | "May" | "Jun" | "Jul" | "Aug"
 "/                      | "Sep" | "Oct" | "Nov" | "Dec"
 
-    |meUTC|
+    |meUTC timeInfo|
 
     meUTC := AbsoluteTime fromSeconds:((self asSeconds) + (self utcOffset)).
+    timeInfo := meUTC timeInfo.
 
-    aStream nextPutAll:(#('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') at:meUTC dayInWeek);
+    aStream nextPutAll:(#('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') at:timeInfo dayInWeek);
             nextPutAll:', '.
-    meUTC day printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo day printOn:aStream leftPaddedTo:2 with:$0.
     aStream space.
-    aStream nextPutAll:(#('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec') at:meUTC month).
+    aStream nextPutAll:(#('Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec') at:timeInfo month).
 
 "/ The following line is wrong, because the names are printed in the current locale!!
-"/    meUTC printOn:aStream format:'%(ShortDayName), %(day) %(ShortMonthName) %y %h:%m:%s GMT'. 
+"/    timeInfo printOn:aStream format:'%(ShortDayName), %(day) %(ShortMonthName) %y %h:%m:%s GMT'. 
 
 "/ the following is too slow for heavy use    
-"/    meUTC printOn:aStream format:' %y %h:%m:%s GMT'. 
+"/    timeInfo printOn:aStream format:' %y %h:%m:%s GMT'. 
 
     aStream nextPut:Character space.
-    meUTC year printOn:aStream.
+    timeInfo year printOn:aStream.
     aStream nextPut:Character space.
-    meUTC hour printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo hours printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPut:$:.
-    meUTC minute printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo minutes printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPut:$:.
-    meUTC second printOn:aStream leftPaddedTo:2 with:$0.
+    timeInfo seconds printOn:aStream leftPaddedTo:2 with:$0.
     aStream nextPutAll:' GMT'.
 
     "
-     AbsoluteTime now printRFC1123FormatOn:Transcript
+     AbsoluteTime now printRFC1123FormatOn:Transcript   
     "
 !
 
@@ -1208,5 +1213,5 @@
 !AbsoluteTime class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.84 2003-11-03 16:39:54 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.85 2003-11-04 11:10:50 penk Exp $'
 ! !