--- a/Timestamp.st Thu May 05 06:48:19 2016 +0200
+++ b/Timestamp.st Thu May 12 09:30:28 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -231,24 +229,6 @@
"Modified: / 13.7.1999 / 12:30:47 / stefan"
!
-newDay:day month:month year:year
- "return a new Timestamp, given the year, month and day (starting at 1).
- Date protocol compatibility"
-
- ^ self
- year:year
- month:month
- day:day
- hour:0
- minute:0
- second:0
- millisecond:0
-
- "
- Timestamp newDay:1 month:1 year:1996
- "
-!
-
newDay:dayInYear year:year
"return a new Timestamp, given the year and the day-in-year (starting at 1).
Date protocol compatibility"
@@ -323,6 +303,24 @@
"Created: / 08-01-2011 / 16:05:09 / cg"
!
+year:year month:month day:day
+ "return a new Timestamp, given the year, month and day (starting at 1).
+ Date protocol compatibility"
+
+ ^ self
+ year:year
+ month:month
+ day:day
+ hour:0
+ minute:0
+ second:0
+ millisecond:0
+
+ "
+ Timestamp year:1996 month:1 day:1
+ "
+!
+
year:y month:m day:d hour:h minute:min second:s
"return an instance of the receiver, given individual components.
See also `Timestamp now' and other protocol inherited
@@ -335,6 +333,7 @@
Timestamp year:1991 month:1 day:2 hour:12 minute:30 second:0
Timestamp year:1991 month:1 day:2 hour:12 minute:30 second:0 millisecond:100
Timestamp year:2000 month:7 day:1 hour:1 minute:0 second:0
+ Timestamp year:2080 month:7 day:1 hour:1 minute:0 second:0
"
"Modified: / 1.7.1996 / 15:22:07 / cg"
@@ -372,8 +371,8 @@
"Answer a new instance for the value given by aStringOrStream"
^ self
- readFrom:aStringOrStream
- onError:[ ConversionError raiseRequestWith:aStringOrStream errorString:' - timestamp']
+ readFrom:aStringOrStream
+ onError:[ TimeConversionError raiseRequestWith:aStringOrStream errorString:' - timestamp']
"
self readFrom:'23-jun-2000 15:00'
@@ -445,8 +444,28 @@
"Created: / 1.7.1996 / 14:46:09 / cg"
"Modified: / 1.7.1996 / 15:22:07 / cg"
"Modified: / 13.7.1999 / 12:30:26 / stefan"
+!
+
+newDay:day month:month year:year
+ <resource: #obsolete>
+ "return a new Timestamp, given the year, month and day (starting at 1).
+ Date protocol compatibility"
+
+ ^ self
+ year:year
+ month:month
+ day:day
+ hour:0
+ minute:0
+ second:0
+ millisecond:0
+
+ "
+ Timestamp newDay:1 month:1 year:1996
+ "
! !
+
!Timestamp class methodsFor:'private'!
basicReadFrom:aStream
@@ -1541,7 +1560,7 @@
'IDLW' -720 false "/ international date line west
'IDLE' 720 false "/ international date line east
- 'MEZ' 60 false "/ mittel europäische Zeit / central european (german)
+ 'MEZ' 60 false "/ mittel europäische Zeit / central european (german)
'MESZ' 120 true "/ central european summer (german)
'WESZ' 60 true "/ west european summer (german)
@@ -1690,6 +1709,7 @@
"
! !
+
!Timestamp methodsFor:'accessing'!
day
@@ -2430,23 +2450,23 @@
given y,m,d and h,m,s in local time"
Error handle:[:ex |
- "handler for timestamps before the epoch or after the OS representable time (2038 on current Unices).
- Then, an out-of-os-range osTime is generated here manually."
-
- |deltaDays|
-
- deltaDays := self class epoch asDate subtractDate:(Date newDay:d month:m year:y).
- "/ deltadays will be negative for dates before the epoch and positive if after.
-
- osTime := (h * 3600) + (min * 60) + s.
- osTime := osTime - (deltaDays * 24 * 3600).
- osTime := osTime * 1000.
- osTime := osTime + millis.
+ "handler for timestamps before the epoch or after the OS representable time (2038 on current Unices).
+ Then, an out-of-os-range osTime is generated here manually."
+
+ |deltaDays|
+
+ deltaDays := self class epoch asDate subtractDate:(Date year:y month:m day:d).
+ "/ deltadays will be negative for dates before the epoch and positive if after.
+
+ osTime := (h * 3600) + (min * 60) + s.
+ osTime := osTime - (deltaDays * 24 * 3600).
+ osTime := osTime * 1000.
+ osTime := osTime + millis.
] do:[
- osTime := OperatingSystem
- computeOSTimeFromUTCYear:y month:m day:d
- hour:h minute:min second:s
- millisecond:millis
+ osTime := OperatingSystem
+ computeOSTimeFromUTCYear:y month:m day:d
+ hour:h minute:min second:s
+ millisecond:millis
]
!
@@ -2455,24 +2475,24 @@
given y,m,d and h,m,s in local time. If the OS cannot do it, do it here."
TimeConversionError handle:[:ex |
- "handler for timestamps before the epoch or after the OS representable time (2038 on current Unices).
- Then, an out-of-os-range osTime is generated here manually."
-
- |deltaDays|
-
- deltaDays := self class epoch asDate subtractDate:(Date newDay:d month:m year:y).
- "/ deltadays will be negative for dates before the epoch and positive if after.
-
- osTime := (h * 3600) + (min * 60) + s.
- osTime := osTime + self utcOffset.
- osTime := osTime - (deltaDays * 24 * 3600).
- osTime := osTime * 1000.
- osTime := osTime + millis.
+ "handler for timestamps before the epoch or after the OS representable time (2038 on current Unices).
+ Then, an out-of-os-range osTime is generated here manually."
+
+ |deltaDays|
+
+ deltaDays := self class epoch asDate subtractDate:(Date year:y month:m day:d).
+ "/ deltadays will be negative for dates before the epoch and positive if after.
+
+ osTime := (h * 3600) + (min * 60) + s.
+ osTime := osTime + self utcOffset.
+ osTime := osTime - (deltaDays * 24 * 3600).
+ osTime := osTime * 1000.
+ osTime := osTime + millis.
] do:[
- osTime := OperatingSystem
- computeOSTimeFromYear:y month:m day:d
- hour:h minute:min second:s
- millisecond:millis
+ osTime := OperatingSystem
+ computeOSTimeFromYear:y month:m day:d
+ hour:h minute:min second:s
+ millisecond:millis
]
!
@@ -3057,6 +3077,8 @@
"
! !
+
+
!Timestamp methodsFor:'testing'!
isLocalTimestamp