TZTimestamp.st
changeset 16954 e13618117ebc
child 16966 7d549c75105f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TZTimestamp.st	Fri Nov 07 13:12:01 2014 +0100
@@ -0,0 +1,95 @@
+"
+ COPYRIGHT (c) 2014 by eXept Software AG
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libbasic' }"
+
+Timestamp subclass:#TZTimestamp
+	instanceVariableNames:'utcOffset'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Magnitude-Time'
+!
+
+!TZTimestamp class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2014 by eXept Software AG
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    This class represents time values in milliSeconds starting some time in the past,
+    which were created in another (explicit) timezone.
+    Internally, they keep the milliseconds based on UTC time (just like the other timestamps),
+    so the time values can be compared easily.
+    However, wehn printed, the original timezone information is taken into account.
+
+    Also Note:
+        On UNIX, osTime can only hold dates between 1970-01-01T00:00:00Z and 2038-01-19T00:00:00Z
+        However, timestamp instances can now hold negative osTime values (which are timestamps
+        before 1.1.1970 and greater than 4294967295 (2^32-1) for timestamps after 2038-01-19.
+
+    [author:]
+        Claus Gittinger
+
+    [See also:]
+        Timestamp UtcTimestamp Time Date
+"
+! !
+
+!TZTimestamp methodsFor:'accessing'!
+
+utcOffset
+    "return the difference between UTC (Greenwich Mean Time) and the local time in seconds.
+     If daylight saving time applies to ourself, take that into account.
+
+     Add utcOffset to convert from local time to UTC time.
+     Subtract utcOffset to convert from UTC time to local time.
+
+     If utcOffset is negative, the local timezone is east of Greenwich.
+     If utcOffset is positive, the local timezone is west of Greenwich."
+
+    ^  utcOffset
+!
+
+utcOffset:seconds
+    "set the difference between UTC (Greenwich Mean Time) and the local time in seconds.
+     If daylight saving time applies to ourself, take that into account.
+
+     Add utcOffset to convert from local time to UTC time.
+     Subtract utcOffset to convert from UTC time to local time.
+
+     If utcOffset is negative, the local timezone is east of Greenwich.
+     If utcOffset is positive, the local timezone is west of Greenwich."
+
+    utcOffset := seconds
+! !
+
+!TZTimestamp class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/TZTimestamp.st,v 1.1 2014-11-07 12:12:01 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic/TZTimestamp.st,v 1.1 2014-11-07 12:12:01 cg Exp $'
+! !
+