added: #utcSecondsSince1970:
authorClaus Gittinger <cg@exept.de>
Sat, 08 Jan 2011 16:06:55 +0100
changeset 13198 e2a13fc1a972
parent 13197 74f2ab2f4c51
child 13199 2e828a00908e
added: #utcSecondsSince1970: changed: #secondsSince1970:
Timestamp.st
--- a/Timestamp.st	Sat Jan 08 10:58:38 2011 +0100
+++ b/Timestamp.st	Sat Jan 08 16:06:55 2011 +0100
@@ -585,14 +585,16 @@
     "Modified: / 05-10-2010 / 16:05:32 / cg"
 !
 
-secondsSince1970:sec
+secondsSince1970:secs
     "set time from elapsed seconds since 1-1-1970, 0:0:0.
      This is the format used in the UNIX world"
 
-    |divMod|
-
-    divMod := sec divMod:3600.
-    ^ self year:1970 month:1 day:1 hour:(divMod at:1) minute:0 second:(divMod at:2) millisecond:0.
+    ^ self basicNew setSeconds:(secs - OperatingSystem utcOffset)
+
+"/    |divMod|
+"/
+"/    divMod := secs divMod:3600.
+"/    ^ self year:1970 month:1 day:1 hour:(divMod at:1) minute:0 second:(divMod at:2) millisecond:0.
 
     "
      Timestamp secondsSince1970:0      
@@ -600,8 +602,30 @@
      Timestamp secondsSince1970:3600*24
     "
 
-    "Created: / 21.10.1996 / 17:48:30 / stefan"
-    "Modified: / 13.7.1999 / 12:31:22 / stefan"
+    "Created: / 21-10-1996 / 17:48:30 / stefan"
+    "Modified: / 13-07-1999 / 12:31:22 / stefan"
+    "Modified: / 08-01-2011 / 16:06:28 / cg"
+!
+
+utcSecondsSince1970:secs
+    "set time from elapsed seconds since 1-1-1970, 0:0:0.
+     This is the format used in the UNIX world"
+
+    ^ self basicNew setSeconds:secs
+
+"/    |divMod|
+"/
+"/    divMod := secs divMod:3600.
+"/    ^ self year:1970 month:1 day:1 hour:(divMod at:1) minute:0 second:(divMod at:2) millisecond:0.
+
+    "
+     Timestamp secondsSince1970:0      
+     Timestamp secondsSince1970:3600    
+     Timestamp secondsSince1970:3600*24  
+    "
+
+    "Modified: / 13-07-1999 / 12:31:22 / stefan"
+    "Created: / 08-01-2011 / 16:05:09 / cg"
 !
 
 year:y month:m day:d hour:h minute:min second:s
@@ -890,7 +914,6 @@
     "Created: / 16-06-2005 / 16:13:36 / masca"
 ! !
 
-
 !Timestamp methodsFor:'accessing'!
 
 day
@@ -1675,8 +1698,6 @@
     "
 ! !
 
-
-
 !Timestamp methodsFor:'visiting'!
 
 acceptVisitor:aVisitor with:aParameter
@@ -2436,11 +2457,11 @@
 !Timestamp class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.131 2010-10-05 14:40:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.132 2011-01-08 15:06:55 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.131 2010-10-05 14:40:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.132 2011-01-08 15:06:55 cg Exp $'
 ! !
 
 Timestamp initialize!