eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AbstractTime':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: AbstractTime


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--AbstractChronologyObject
         |
         +--AbstractTime
            |
            +--Time
            |
            +--Timestamp

Package:
stx:libbasic
Category:
Kernel-Chronology
Version:
rev: 1.172 date: 2024/04/25 13:03:48
user: stefan
file: AbstractTime.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


This is an abstract class providing common protocol for Time (time in day)
and Timestamp (time plus day).
There are no instances of this class in the system.
It is meant as a home for methods common to time handling classes.

copyright

COPYRIGHT (c) 1995 by Claus Gittinger 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.

iso8601FormatDocumentation

Abstract This document defines a profile of ISO 8601, the International Standard for the representation of dates and times. ISO 8601 describes a large number of date/time formats. To reduce the scope for error and the complexity of software, it is useful to restrict the supported formats to a small number. This profile defines a few date/time formats, likely to satisfy most requirements. Formats Different standards may need different levels of granularity in the date and time, so this profile defines six levels. Standards that reference this profile should specify one or more of these granularities. If a given standard allows more than one granularity, it should specify the meaning of the dates and times with reduced precision, for example, the result of comparing two dates with different precisions. The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the 'T' appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07) Complete date: YYYY-MM-DD (eg 1997-07-16) Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) Complete date plus hours, minutes and seconds: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) where: YYYY = four-digit year MM = two-digit month (01=January, etc.) DD = two-digit day of month (01 through 31) hh = two digits of hour (00 through 23) (am/pm NOT allowed) mm = two digits of minute (00 through 59) ss = two digits of second (00 through 59) s = one or more digits representing a decimal fraction of a second TZD = time zone designator (Z or +hh:mm or -hh:mm) This profile does not specify how many digits may be used to represent the decimal fraction of a second. An adopting standard that permits fractions of a second must specify both the minimum number of digits (a number greater than or equal to one) and the maximum number of digits (the maximum may be stated to be 'unlimited'). This profile defines two ways of handling time zone offsets: 1.Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator ('Z'). 2.Times are expressed in local time, together with a time zone offset in hours and minutes. A time zone offset of '+hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and 'mm' minutes ahead of UTC. A time zone offset of '-hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and 'mm' minutes behind UTC. A standard referencing this profile should permit one or both of these ways of handling time zone offsets. The ISO8601 printString are generated with: Year: YYYY (eg 1997) Date today printStringFormat:'%(year)' Timestamp now printStringFormat:'%(year)' Year and month: YYYY-MM (eg 1997-07) Date today printStringFormat:'%(year)-%(month)' Timestamp now printStringFormat:'%(year)-%(month)' Complete date: YYYY-MM-DD (eg 1997-07-16) Date today printStringFormat:'%(year)-%(month)-%(day)' Timestamp now printStringFormat:'%(year)-%(month)-%(day)' Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)' Complete date plus hours, minutes and seconds: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)' Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)'

printFormatDocumentation

bindings: %h hours, 00..23 (i.e. european) 0-padded to length 2 %u hours, 00..12 (i.e. us) 0-padded to length 2 %m minutes, 00..59 0-padded to length 2 %s seconds, 00..59 0-padded to length 2 %i milliseconds, 000..999 0-padded to length 3 %a am/pm Timestamp only: %(day) day, 00..31 0-padded to length 2 %(month) month, 00..12 0-padded to length 2 %(year) year, 4 digits 0-padded to length 4 special: %H 24-hours - unpadded %U 12-hours - unpadded %M minutes - unpadded %S seconds - unpadded %I milliseconds, unpadded %A AM/PM - uppercase %t seconds within hour (unpadded) %T seconds from midNight (unpadded) %(TZD) timeZone delta of the receiver from UTC in the format +/-hh:mm %(milli1) milliseconds, truncated to 1/10th of a second 0..9 %(milli2) milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2 %(milli3) milliseconds, same as %i for convenience Timestamp only: %(Day) - day - unpadded %(Month) - month - unpadded %(yearOrTime) - year or time 5 digits as in unix-ls: year if it is not the current year; time otherwise %(weekDay) - day in week (1->monday, 2->tuesday, ... ,7->sunday) %(dayName) - full day name %(DayName) - full day name, first character uppercase %(DAYNAME) - full day name, all uppercase %(monthName) - full month name %(MonthName) - full month name, first character uppercase %(MONTHNAME) - full month name, all uppercase %(shortDayName) - short (abbreviated) day name %(ShortDayName) - short (abbreviated) day name, first character uppercase %(SHORTDAYNAME) - short (abbreviated) day name, all uppercase %(shortMonthName) - short (abbreviated) month name %(ShortMonthName) - short (abbreviated) month name, first character uppercase %(SHORTMONTHNAME) - short (abbreviated) month name, all uppercase %(nth) - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') %(weekDayNth) - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') %(weekNth) - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') %(yearRoman) - year, in roman letters %(monthRoman) - month, in roman letters The ISO8601 printString are documented in iso8601FormatDocumentation:

Class protocol:

Compatibility-Squeak
o  dateAndTimeFromSeconds: secondCount
set date and time from seconds since 1901-01-01 00:00 UTC

Usage example(s):

     Timestamp dateAndTimeFromSeconds: (Time primSecondsClock) 
     Time dateAndTimeFromSeconds: (Time totalSeconds) 
     Date dateAndTimeFromSeconds: (Time totalSeconds)

o  milliseconds: msTime1 since: msTime2
return the number of milliseconds between two
millisecond time values, compensating for roll-over.
The same as millisecondsBetween:and: for Squeak compatibility.

o  millisecondsSince: lastTime
Answer the elapsed time since last recorded in milliseconds.
Compensate for rollover.

o  primSecondsClock
returns the number of seconds since 1.1.1901 UTC

Usage example(s):

     Timestamp primSecondsClock

Compatibility-VW
o  microsecondClock
( an extension from the stx:libcompat package )

o  totalSeconds
returns the number of seconds since 1.1.1901 UTC

error handling
o  conversionErrorSignal
return the signal used for conversion error handling

format strings
o  defaultFormatString

o  printBindingMirrorClass

instance creation
o  epoch
answer the time when we start counting

Usage example(s):

     Timestamp epoch
     Time epoch     

o  now
return an instance of myself representing this moment with at least second precision.
Timestamps will redefine this to always return millisecond precision.

Usage example(s):

     Timestamp now     => 2022-03-09 00:49:50.082
     UtcTimestamp now  => 2022-03-08 23:50:10.510Z
     TZTimestamp now   => 2022-03-09 00:50:34.391+01
     Time now          => 12:50:22 AM

o  nowWithMicroseconds
return an instance of myself representing this moment with microsecond precision.
(if supported by the operating system; if not, you'll get milli resolution)

Usage example(s):

     Timestamp now   
     Time now
     Timestamp nowWithMilliseconds      2022-03-09 01:04:02.554
     Timestamp nowWithMicroseconds      2022-03-09 01:04:04.074

     TZTimestamp nowWithMilliseconds    2022-03-09 01:04:05.929+01
     TZTimestamp nowWithMicroseconds    2022-03-09 01:04:07.275+01

     UtcTimestamp nowWithMilliseconds   2022-03-09 00:04:08.666Z
     UtcTimestamp nowWithMicroseconds   2022-03-09 00:04:09.898Z

     (1 to:200) collect:[:y|
        Timestamp nowWithMicroseconds
     ]

o  nowWithMilliseconds
return an instance of myself representing this moment with millisecond precision.
(if supported by the operating system; if not, you'll get whatever the ticks are)

Usage example(s):

     Time now
     Time nowWithMilliseconds 

     Timestamp now   
     Timestamp nowWithMilliseconds
     Timestamp nowWithMicroseconds

o  nowWithNanoseconds
return an instance of myself representing this moment with nanosecond precision.
(if supported by the operating system; if not, you'll get micro or milli resolution)

Usage example(s):

     Timestamp now   
     Time now
     Timestamp nowWithMilliseconds      2022-03-09 01:04:02.554
     Timestamp nowWithMicroseconds      2022-03-09 01:04:04.074
     Timestamp nowWithNanoseconds       2024-03-01 11:43:42.918

     TZTimestamp nowWithMilliseconds    2022-03-09 01:04:05.929+01
     TZTimestamp nowWithMicroseconds    2022-03-09 01:04:07.275+01
     TZTimestamp nowWithNanoseconds     2024-03-01 11:43:53.630+01

     UtcTimestamp nowWithMilliseconds   2022-03-09 00:04:08.666Z
     UtcTimestamp nowWithMicroseconds   2022-03-09 00:04:09.898Z
     UtcTimestamp nowWithNanoseconds    2024-03-01 10:44:01.370Z

     { UtcTimestamp nowWithNanoseconds. UtcTimestamp nowWithNanoseconds}

     (1 to:200) collect:[:y|
        Timestamp nowWithMicroseconds
     ]

o  utcNow
return an instance of myself representing this momentin the UTC timezone.

** This method must be redefined in concrete classes (subclassResponsibility) **

private-instance creation
o  fromOSTime: osTime
return a time, representing the time given by the operatingSystem time.
Not meant for public use.

o  fromSeconds: seconds
return an instance that is constructed from seconds.
This method is only allowed for second values as returned by
getSeconds, possibly adding/subtracting to that.
Never depend on any specific interpretation of the seconds,
since it depends on how the OperatingSystem counts time
(some start at 1900, others with 1970 ...)

Usage example(s):

     Time fromSeconds:0             should return midnight
     Timestamp fromSeconds:0     on UNIX: returns 1st. Jan 1970
                                    on others: don't know
     (Timestamp day:1 month:1 year:1970 hour:1 minutes:0 seconds:0)
        getSeconds                  on UNIX: returns 0
                                    on others: don't know

queries
o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.

o  microsecondClockValue
This returns a microsecond timer value.
The returned value is a 64bit value
(which is the number of microseconds since the system's boot time -
but you should not depend on that because it is system specific.
Only use for relative delta-times.

Usage example(s):

     Time microsecondClockValue

Usage example(s):

     |t1 t2 overhead|

     t1 := Time microsecondClockValue.
     t2 := Time microsecondClockValue.
     overhead := t2 - t1.  

     t1 := Time microsecondClockValue.
     100 factorial.
     t2 := Time microsecondClockValue.
     t2 - t1 - overhead        

o  millisecondClockValue
return the millisecond clock - since this one overruns
regularly, use the value only for short timing deltas.
Also remember that it wraps when comparing these values.

Usage example(s):

     Time millisecondClockValue 

o  secondClock
return seconds of now - for GNU-ST compatibility

Usage example(s):

     AbstractTime secondClock    

reading
o  readFrom: aStringOrStream format: formatString
see format description in readFrom:format:language:onError:

o  readFrom: aStringOrStream format: formatString language: languageString onError: exceptionalValue
see format description in readFrom:format:language:onError:

** This method must be redefined in concrete classes (subclassResponsibility) **

o  readFrom: aStringOrStream format: formatString onError: exceptionalValue
see format description in readFrom:format:language:onError:

timing evaluations
o  microsecondsToRun: aBlock
evaluate the argument, aBlock; return the number of microseconds it took

Usage example(s):

     Time microsecondsToRun:[1000 factorial]  

o  millisecondsToRun: aBlock
evaluate the argument, aBlock; return the number of milliseconds it took

Usage example(s):

     Time millisecondsToRun:[1000 factorial]  

o  secondsToRun: aBlock
evaluate the argument, aBlock; return the number of seconds it took

Usage example(s):

     Time secondsToRun:[1000 factorial]  

o  toRun: aBlock
return the TimeDuration it takes to execute aBlock.
A modern variant of Time millisecondsToRun: (which prints itself nicely)

Usage example(s):

     Time toRun:[ 20000 factorial ]     
     Time toRun:[ 2000 factorial ]     
     Time toRun:[ 900 factorial ]     
     Time toRun:[ 10 factorial ]     


Instance protocol:

Compatibility-ANSI
o  hour12
return the hour (1..12).

Usage example(s):

     Time now hour12   
     Time now hour24   
     (Time hours:0 minutes:0 seconds:0) hour24   
     (Time hours:0 minutes:0 seconds:0) hour12   
     (Time hours:1 minutes:0 seconds:0) hour24   
     (Time hours:1 minutes:0 seconds:0) hour12   
     (Time hours:12 minutes:0 seconds:0) hour24 
     (Time hours:12 minutes:0 seconds:0) hour12   
     (Time hours:13 minutes:0 seconds:0) hour24 
     (Time hours:13 minutes:0 seconds:0) hour12   
     (Time hours:23 minutes:0 seconds:0) hour24 
     (Time hours:23 minutes:0 seconds:0) hour12   
     (Time hours:24 minutes:0 seconds:0) hour24 
     (Time hours:24 minutes:0 seconds:0) hour12   

o  hour24
return the hour (0..23).

Usage example(s):

     Time now hour12   
     Time now hour24   
     (Time hours:0 minutes:0 seconds:0) hour24 
     (Time hours:0 minutes:0 seconds:0) hour12 
     (Time hours:1 minutes:0 seconds:0) hour24 
     (Time hours:1 minutes:0 seconds:0) hour12 
     (Time hours:12 minutes:0 seconds:0) hour24 
     (Time hours:12 minutes:0 seconds:0) hour12 
     (Time hours:13 minutes:0 seconds:0) hour24 
     (Time hours:13 minutes:0 seconds:0) hour12 
     (Time hours:23 minutes:0 seconds:0) hour24 
     (Time hours:23 minutes:0 seconds:0) hour12 
     (Time hours:24 minutes:0 seconds:0) hour24 
     (Time hours:24 minutes:0 seconds:0) hour12 

o  meridianAbbreviation
am/pm

Usage example(s):

     Time now meridianAbbreviation   
     (Time hours:0 minutes:0 seconds:0) meridianAbbreviation   
     (Time hours:11 minutes:59 seconds:59) meridianAbbreviation  
     (Time hours:12 minutes:0 seconds:0) meridianAbbreviation    
     (Time hours:12 minutes:0 seconds:1) meridianAbbreviation   

Compatibility-ST80
o  hour
return the hour (0..23).
ST-80 Timestamp compatibility
(I'd prefer the name #hours, for Time compatibility).

o  minute
return the minute (0..59).
ST-80 Timestamp compatibility
(I'd prefer the name #minutes, for Time compatibility).

o  second
return the second (0..59).
ST-80 Timestamp compatibility
(I'd prefer the name #seconds, for Time compatibility).

JavaScript support
o  js_add: aNumberOrString
( an extension from the stx:libjavascript package )
For JavaScript only:
Generated for +-operator in javascript.
See JavaScriptParser >> commonTranslatedSelectorFor:jsSelector

o  js_addFromTime: aTime
( an extension from the stx:libjavascript package )
For JavaScript only:
Generated for +-operator in javascript.

o  js_getHours
( an extension from the stx:libjavascript package )
return the hours (0..24).
For JavaScript only:
Generated for getHours() in javascript.
See JavaScriptParser >> commonTranslatedSelectorFor:jsSelector

o  js_getMilliseconds
( an extension from the stx:libjavascript package )
return the millieconds (0..999).
For JavaScript only:
Generated for getMilliseconds() in javascript.
See JavaScriptParser >> commonTranslatedSelectorFor:jsSelector

Usage example(s):

     JavaScriptParser
        evaluate:'Date.now.js_getMilliseconds;'

o  js_getMinutes
( an extension from the stx:libjavascript package )
return the minutes (0..60).
For JavaScript only:
Generated for getMinutes() in javascript.
See JavaScriptParser >> commonTranslatedSelectorFor:jsSelector

o  js_getSeconds
( an extension from the stx:libjavascript package )
return the seconds (0..60).
For JavaScript only:
Generated for getSeconds() in javascript.
See JavaScriptParser >> commonTranslatedSelectorFor:jsSelector

abstract
o  hours
return the hour of time (0..23)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  milliseconds
return the milliseconds since the start of the second (0..999)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  minutes
return the minutes since the start of the hour (0..59)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  seconds
return the seconds since the start of the minute (0..59)

** This method must be redefined in concrete classes (subclassResponsibility) **

accessing
o  hourInDay
return the hours (0..23)

Usage example(s):

     Timestamp now hourInDay 
     Time now hourInDay 

o  microseconds
return the microseconds within the current second (0..999999)

Usage example(s):

     Timestamp now microseconds   
     Timestamp nowWithMicroseconds microseconds   

o  minuteInDay
return the minutes (0..59)

Usage example(s):

     Timestamp now minuteInDay 
     Time now minuteInDay 

o  nanoseconds
return the nanoseconds within the current second (0..999999)

Usage example(s):

     Timestamp now nanoseconds   
     Timestamp nowWithMicroseconds nanoseconds   

o  picoseconds
return the picoseconds within the current second (0..999999999).
notice: that is NOT the total number of picoseconds,
but the fractional part (within the second) only.
Use this only for printing.
Here, fall back and generate something based on the milliseconds

Usage example(s):

     Timestamp now picoseconds
     Timestamp nowWithMicroseconds picoseconds

     (TimeDuration fromPicoseconds:100) picoseconds
     (TimeDuration fromPicoseconds:100000) picoseconds
     (TimeDuration fromPicoseconds:100000) nanoseconds
     (TimeDuration fromPicoseconds:100000000) picoseconds
     (TimeDuration fromPicoseconds:100000000) nanoseconds
     (TimeDuration fromPicoseconds:100000000) microseconds
     (TimeDuration fromPicoseconds:100000000000) picoseconds
     (TimeDuration fromPicoseconds:100000000000) nanoseconds
     (TimeDuration fromPicoseconds:100000000000) microseconds
     (TimeDuration fromPicoseconds:100000000000) milliseconds

o  secondInDay
return the seconds (0..59)

Usage example(s):

     Timestamp now secondInDay 
     Time now seconds 

o  timeZoneDeltaInMinutes
answer the number of minutes between local time and utc time.
Delta is positive if local time is ahead of utc, negative if behind utc.

o  timeZoneName

o  utcOffset

arithmetic
o  + aNumberOrTimeDuration
Add aNumber (numberOfSeconds) or, if it's a timeDuration, add it's value

Usage example(s):

     Timestamp now to:(Timestamp now + 30) by:2 do:[:time|
        Transcript showCR:time.
     ].
     Timestamp now to:(Timestamp now + 30) by:2 seconds do:[:time|
        Transcript showCR:time.
     ].
     (Timestamp now + 30 seconds) to:(Timestamp now) by:-2 seconds do:[:time|
        Transcript showCR:time.
     ].
     (Timestamp now + 30 seconds) to:(Timestamp now) by:-2 do:[:time|
        Transcript showCR:time.
     ].

     (Timestamp now + 20)  -  Timestamp now  
     (Timestamp now + 0.5)  -  Timestamp now  
     (Timestamp now + (TimeDuration fromString:'1m 10s'))  -  Timestamp now  
     (Timestamp now + (10 seconds))  -  Timestamp now  

o  - aTimeOrTimeDurationOrNumberOfSeconds
return the delta in seconds between 2 times or subtract a number of seconds.

Usage example(s):

should we convert to timestamp i.e. caring for time-wrapping at midnight?

Usage example(s):

no - for compatibility, we'll get the time-within-the day again

Usage example(s):

     Timestamp now - 3600.                          -> 2018-05-09 15:37:57.485
     Timestamp now - 3600 seconds.                  -> 2018-05-09 15:38:04.665
     (Timestamp now addSeconds:10) - Timestamp now  -> 10s

     Time now - 3600.                               -> 03:38:23 PM
     Time now - 3600 seconds.                       -> 03:38:35 PM
     (Time now addSeconds:10) - Time now            -> 10s 
     Time now - 1 hours.                            -> 11:04:02
     Time now - 24 hours.                           -> 11:04:02

     (TimeDuration fromString:'1.5hr') - 3600.                           -> 30m 
     (TimeDuration fromString:'1.5hr') - (TimeDuration fromString:'1hr') -> 30m  

     |t1 t2|

     t1 := Timestamp now.
     Delay waitFor:10 seconds.
     t2 := Timestamp now.
     Transcript showCR:('seconds passed: ' , (t2 - t1) printString).

Usage example(s):

Modified (comment): / 08-05-2019 / 12:49:59 / Claus Gittinger

o  addDays: numberOfDays
return a new instance of myself, numberOfDays afterwards.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t addDays:7)

o  addHours: numberOfHours
return a new instance of myself, numberOfHours afterwards.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t addHours:12).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t addHours:12).

o  addMicroseconds: numberOfMicroSeconds
return a new instance of myself, numberOfMicroSeconds afterwards.

Usage example(s):

     |t1 t2|

     t1 := Timestamp now.
     Transcript showCR:t1.
     t2 := t1 addMicroseconds:1000.
     Transcript showCR:t2.
     t2 := t1 addMicroseconds:1010.
     Transcript showCR:t2.
     Transcript showCR:(t2 - t1).
     self halt.
     Transcript showCR:(t2 - t1) asMicroseconds.

o  addMilliseconds: numberOfMilliSeconds
return a new instance of myself, numberOfMilliSeconds afterwards.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t addMilliseconds:100).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t addMilliseconds:1000).

o  addMinutes: numberOfMinutes
return a new instance of myself, numberOfMinutes afterwards.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t addMinutes:60).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t addMinutes:60).

o  addSeconds: numberOfSeconds
return a new instance of myself, numberOfSeconds afterwards.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t addSeconds:60).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t addSeconds:60).

o  addTime: timeAmount
return a new instance of myself, timeAmount seconds afterwards.
Provided for ST-80 compatibility.
WARNING:
AddTime is a bad name - it does not add a time, but expects
a numberOfSeconds as argument.
Use any of addSeconds/addHours etc. to make things clear

o  deltaFrom: aTimeOrInteger
return the delta as a TimeDuration between 2 timeStamps.
If the argument is an Integer, the return value is an instance of my class.
The argument is supposed to be BEFORE the receiver,
computes self - aTimestamp

Usage example(s):

        Time now deltaFrom:10 minutes.
        Time now deltaFrom:3600.
        Time now deltaFrom:3600 seconds.

        Timestamp now deltaFrom:10 minutes.
        Timestamp now deltaFrom:3600.
        Timestamp now deltaFrom:3600 seconds.

Usage example(s):

     |t1 t2|

     t1 := Timestamp now.
     Delay waitForSeconds:0.5.
     t2 := Timestamp now.
     t2 deltaFrom:t1   

o  subtractDays: numberOfDays
return a new instance of myself, numberOfDays before.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t subtractDays:50)

o  subtractHours: numberOfHours
return a new instance of myself, numberOfHours before.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t subtractHours:12).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t subtractHours:12).

o  subtractMilliseconds: numberOfMilliSeconds
return a new instance of myself, numberOfMilliSeconds before.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t subtractMilliseconds:100).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t subtractMilliseconds:1000).

o  subtractMinutes: numberOfMinutes
return a new instance of myself, numberOfMinutes before.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t subtractMinutes:60).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t subtractMinutes:60).

o  subtractSeconds: numberOfSeconds
return a new instance of myself, numberOfSeconds before.

Usage example(s):

     |t|

     t := Timestamp now.
     Transcript showCR:t.
     Transcript showCR:(t subtractSeconds:60).

Usage example(s):

     |t|

     t := Time now.
     Transcript showCR:t.
     Transcript showCR:(t subtractSeconds:60).

o  subtractTime: timeAmount
return a new instance of myself, timeAmount seconds before myself.
Provided for ST-80 compatibility.
WARNING:
SubtractTime is a bad name - it does not add a time, but expects
a numberOfSeconds as argument.
Use any of addSeconds/addHours etc. to make things clear

comparing
o  < aTimeOrTimeDurationOrNumberOfSeconds
return true if the receiver is before the argument

Usage example(s):

        (Timestamp now + 10) - Timestamp now  < 10
        (Timestamp now + 10) - Timestamp now  < 11

o  <= aTimeOrTimeDurationOrNumberOfSeconds
return true if the receiver is before or the same time as the argument

Usage example(s):

        (Timestamp now + 10) - Timestamp now  <= 10
        (Timestamp now + 10) - Timestamp now  <= 11
        (Timestamp now + 10) - Timestamp now  <= 9

o  = aTimeOrTimeDurationOrNumberOfSeconds
return true if the receiver is the same time or duration as the argument

Usage example(s):

        0 seconds = 0
        (Timestamp now + 10) - Timestamp now  = 10
        (Timestamp now + 10) - Timestamp now  = 9

        (Timestamp now) = (Timestamp now + 10 - 10)
        (Timestamp now) = (UtcTimestamp now)

        (Time now + 10 seconds) - Time now  = 10
        (Time now + 10) - Time now          = 10

        (Time now + 10 seconds) > Time now 
        (Time now + 10)         > Time now      

        (Time now + 10 milliSeconds) > Time now 
        (Time now + 0 milliseconds)  > Time now      

o  > aTimeOrTimeDurationOrNumberOfSeconds
return true if the receiver is after the argument

Usage example(s):

        0 seconds > 0
        (Timestamp now + 10) - Timestamp now  > 10
        (Timestamp now + 10) - Timestamp now  > 9

o  >= aTimeOrTimeDurationOrNumberOfSeconds
return true if the receiver is after the argument or the same

Usage example(s):

        (Timestamp now + 10) - Timestamp now  >= 11
        (Timestamp now + 10) - Timestamp now  >= 10
        (Timestamp now + 10) - Timestamp now  >= 9

o  hash
(comment from inherited method)
instances, for which #= answers true must answer the same hash

converting
o  asAbsoluteTime
deprecated, use #asTimestamp

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  asLocalTimestamp
represent myself as a timestamp in the local timezone

** This method must be redefined in concrete classes (subclassResponsibility) **

o  asMilliseconds
return the number of milliseconds elapsed since some starttime,
which is subclass specific (i.e. Time: since midnight; Timestamp: since the epoch).
Use this only to compute relative millisecond deltas.

Usage example(s):

     Time now asMilliseconds
     Timestamp now asMilliseconds
     (TimeDuration days:1) asMilliseconds
     (TimeDuration hours:1) asMilliseconds

o  asNanoseconds
return the number of nanoseconds elapsed since some starttime,
which is subclass specific (i.e. Time: since midnight; Timestamp: since the epoch).
Use this only to compute relative nanosecond deltas.

Usage example(s):

     Time now asNanoseconds

o  asSeconds
get the seconds since some point of time in the past.
For Time instances, this is the number of seconds elapsed since midnight (truncated);
For TimeDurations, that is the duration in seconds (truncated);
For TimeStamps, that is the number of seconds since the epoch (truncated)

Usage example(s):

     Timestamp now asSeconds
     Time now asSeconds
     (TimeDuration days:1) asSeconds

o  asTZTimestamp
raise an error: must be redefined in concrete subclass(es)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  asTime
return a Time object from the receiver.

Usage example(s):

     (1 seconds + 0.01 seconds) asTime

o  asTimestamp
represent myself as a Timestamp

** This method must be redefined in concrete classes (subclassResponsibility) **

o  asUtcTimestamp
represent myself as a timestamp in the local timezone

** This method must be redefined in concrete classes (subclassResponsibility) **

double dispatching
o  differenceFromTimestamp: aTimestamp
return the time difference as a timeDuration instance

** This method must be redefined in concrete classes (subclassResponsibility) **

inspecting
o  inspectorValueListIconFor: anInspector
( an extension from the stx:libtool package )
returns the icon to be shown alongside the value list of an inspector

printing & storing
o  addBasicPrintBindingsTo: aDictionary language: languageOrNil
marked as obsolete by exept MBP at 04-12-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  addPrintBindingsTo: aDictionary language: languageOrNil
marked as obsolete by exept MBP at 04-12-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  printIso8601CompressedOn: aStream
Timestamp now printStringIso8601 -> '2018-05-09T12:15:53.279'
Time now printStringIso8601 -> 'T16:27:08'
Date today printStringIso8601 -> '2018-05-09'

Timestamp now printStringIso8601Compressed -> '20180525T120822.699'
Time now printStringIso8601Compressed -> 'T120837'
Date today printStringIso8601Compressed -> '20180525'


** This method must be redefined in concrete classes (subclassResponsibility) **

o  printIso8601FormatOn: aStream
Timestamp now printStringIso8601 -> '2018-05-09T12:15:53.279+02'
Time now printStringIso8601 -> 'T16:27:08'
Date today printStringIso8601 -> '2018-05-09'


** This method must be redefined in concrete classes (subclassResponsibility) **

o  printIso8601FormatWithSubMilliseconds: withSubMilliseconds on: aStream
Timestamp now printStringIso8601 -> '2018-05-09T12:15:53.279+02'
Time now printStringIso8601 -> 'T16:27:08'
Date today printStringIso8601 -> '2018-05-09'


** This method must be redefined in concrete classes (subclassResponsibility) **

o  printOn: aStream format: aFormatString
print using a format string;
See AbstractTime::PrintBindingMirror class >> #documentation for allowed format strings

Usage example(s):

     Timestamp now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%H:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%u:%m:%s %a'. Transcript cr.   
     Time now printOn:Transcript format:'%h:%m'      . Transcript cr. 
     Time now printOn:Transcript format:'%H:%m %A'   . Transcript cr.
     Time now printOn:Transcript format:'minutes:%M seconds:%S'. Transcript cr.

o  printOn: aStream format: aFormatString language: languageOrNil
print using a format string;
See AbstractTime::PrintBindingMirror class >> #documentation for allowed format strings

Usage example(s):

     Timestamp now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%h:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%H:%m:%s'   . Transcript cr.      
     Time now printOn:Transcript format:'%u:%m:%s %a'. Transcript cr.   
     Time now printOn:Transcript format:'%h:%m'      . Transcript cr. 
     Time now printOn:Transcript format:'%H:%m %A'   . Transcript cr.
     Time now printOn:Transcript format:'minutes:%M seconds:%S'. Transcript cr.

o  printStringFormat: aFormatString
print using a format string.
See AbstractTime::PrintBindingMirror class >> #documentation for allowed format strings

Usage example(s):

     Timestamp now printStringFormat:'%U:%m:%s %a'        
     Timestamp now printStringFormat:'%u:%m:%s %a'        
     Time now printStringFormat:'%U:%m:%s %a'   
     Time now printStringFormat:'%u:%m:%s %a'   

     Time now printStringFormat:'%h:%m:%s'      
     Time now printStringFormat:'%H:%m:%s'      
     Time now printStringFormat:'%H:%m:%s.%i'           
     Timestamp now printStringFormat:'%H:%m:%s.%i'   
     Timestamp now printStringFormat:'%H:%m:%s.%(milli1)'   
     Timestamp now printStringFormat:'%H:%m:%s.%(milli2)'     
     Timestamp now printStringFormat:'%(day)-%(month)-%(year) :%m:%s'       => '12-03-2024 :03:53'
     Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s'   => '12-march-2024 :03:58'    
     Timestamp now printStringFormat:'%(day)-%(monthname)-%(year) :%m:%s'   => '12-march-2024 :03:58'    
     Timestamp now printStringFormat:'%(day)-%(MonthName)-%(year) :%m:%s'   => '12-March-2024 :04:32'    
     Timestamp now printStringFormat:'%(day)-%(MONTHNAME)-%(year) :%m:%s'   => '12-MARCH-2024 :05:27'    
     Timestamp now printStringFormat:'%(dayName)-%(month)-%(year) :%m:%s'   => 'tuesday-03-2024 :06:35'    
     Timestamp now printStringFormat:'%(DayName)-%(month)-%(year) :%m:%s'   => 'Tuesday-03-2024 :06:51'    
     Timestamp now printStringFormat:'%(DAYNAME)-%(month)-%(year) :%m:%s'   => 'TUESDAY-03-2024 :06:57'    
     Time now printStringFormat:'%u:%m:%s %a'   
     Time now printStringFormat:'%h:%m'         
     Time now printStringFormat:'%h:%m'         
     Time now printStringFormat:'%H:%m %A'     
     Time now printStringFormat:'%m minutes after %U %a'     
     Time now printStringFormat:'%t seconds after %U %a'     
     Time now printStringFormat:'%T seconds from midNight'     

o  printStringFormat: aFormatString language: languageString
print using a format string.
See AbstractTime::PrintBindingMirror class >> #documentation for allowed format strings

Usage example(s):

     Timestamp now printStringFormat:'%U:%m:%s %a'  
     Time now printStringFormat:'%U:%m:%s %a'   

     Time now printStringFormat:'%h:%m:%s'      
     Time now printStringFormat:'%H:%m:%s'      
     Time now printStringFormat:'%H:%m:%s.%i'           
     Timestamp now printStringFormat:'%H:%m:%s.%i'   
     Timestamp now printStringFormat:'%H:%m:%s.%(milli1)'   
     Timestamp now printStringFormat:'%H:%m:%s.%(milli2)'     
     Timestamp now printStringFormat:'%(day)-%(month)-%(year) :%m:%s'       
     Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s' language:#en      
     Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s' language:#de      
     Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s' language:#fr      
     Time now printStringFormat:'%u:%m:%s %a'   
     Time now printStringFormat:'%h:%m'         
     Time now printStringFormat:'%h:%m'         
     Time now printStringFormat:'%H:%m %A'     
     Time now printStringFormat:'%m minutes after %U %a'     
     Time now printStringFormat:'%t seconds after %U %a'     
     Time now printStringFormat:'%T seconds from midNight'     

o  printStringIso8601
return the Iso8601 representation of the receiver with local timezon information.
This format looks like:
1999-01-01T24:00:00
or, for zero hr:min:sec,
1999-01-01
Of course, a 24 hour clock is used.

Usage example(s):

     Timestamp now printStringIso8601

o  printStringIso8601Compressed
return the Iso8601 representation of the receiver with local timezon information.
This format looks like:
1999-01-01T24:00:00
or, for zero hr:min:sec,
1999-01-01
Of course, a 24 hour clock is used.

Usage example(s):

     Timestamp now printStringIso8601Compressed

o  printStringIso8601Format
would like to make it obsolete, but it is:

Usage example(s):

     Timestamp now printStringIso8601Format

private
o  fromOSTime: osTime
set my time, from operatingSystems time parts

** This method must be redefined in concrete classes (subclassResponsibility) **

o  fromOSTimeWithMilliseconds: anUninterpretedOSTime
strictly private: set the milliseconds from an OS time (since the epoch)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  fromOSTimeWithMilliseconds: anUninterpretedOSTime additionalPicoseconds: picos
strictly private: set the milliseconds and picoSeconds from an OS time (since the epoch)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  getMicroseconds
get the milliseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.
Also be aware that the returned value is concrete-class specific;
Time returns the micros since midnight, Timestamp since the epoch.
Use this only to compute relative time deltas.
Here is a fallback, which only returns milliseocnd precision values

o  getMilliseconds
get the milliseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.
Also be aware that the returned value is concrete-class specific;
Time returns the millis since midnight, Timestamp since the epoch.
Use this only to compute relative time deltas.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  getNanoseconds
get the nanoseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.
Also be aware that the returned value is concrete-class specific;
Time returns the nanos since midnight, Timestamp since the epoch.
Use this only to compute relative time deltas.
Here is a fallback, which only returns microseocnd precision values

o  getSeconds
get the (truncated) seconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  setMicroseconds: nanos
set the microseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

o  setMilliseconds: millis
set the milliseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  setMilliseconds: arg1 additionalPicoseconds: arg2
raise an error: must be redefined in concrete subclass(es)

** This method must be redefined in concrete classes (subclassResponsibility) **

o  setNanoseconds: nanos
set the nanoseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

o  setPicoseconds: picos
set the picoseconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

o  setSeconds: secs
set the seconds since some point of time in the past.
Since I am abstract (not knowing how the time is actually
represented), this must be done by a concrete class.

** This method must be redefined in concrete classes (subclassResponsibility) **

o  speciesNew

truncation & rounding
o  nextMultipleOf: aTimeDuration
round the receiver up to the next multiple of a TimeDuration.

Usage example(s):

      (TimeDuration fromSeconds:25) nextMultipleOf:60 seconds         => 1m
      (TimeDuration fromMilliseconds:25234) nextMultipleOf:2 seconds  => 26s
      Time now nextMultipleOf:10 minutes                              => 21:40:00
      Timestamp now nextMultipleOf:10 minutes                         => 2023-06-06 21:40:00

o  roundTo: aTimeDuration
round the receiver to the next multiple of a TimeDuration.
Bad name: should be called roundedTo: because it returns a new instance

Usage example(s):

      (TimeDuration fromMicroseconds:25234) roundTo:2 milliSeconds  => 26s
      (TimeDuration fromMilliseconds:25234) roundTo:10 milliSeconds  => 25.23s
      (TimeDuration fromMilliseconds:25234) roundTo:100 milliSeconds => 25.2s
      Time now roundTo:10 minutes                                   => 21:30:00
      Timestamp now roundTo:10 minutes                              => 2023-06-06 21:30:00

o  truncateTo: aTimeDuration
truncate the receiver to the previous multiple of a TimeDuration.
Bad name: should be called truncatedTo: because it returns a new instance

Usage example(s):

      (TimeDuration fromMilliseconds:25234) truncateTo:2 seconds    => 24s
      Time now truncateTo:10 minutes                                => 21:20:00
      Timestamp now truncateTo:10 minutes                           => 2023-06-06 21:20:00


Private classes:

    PrintBindingMirror


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Tue, 10 Dec 2024 09:55:34 GMT