eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AbstractTime':

Home

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

Class: AbstractTime


Inheritance:

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

Package:
stx:libbasic
Category:
Magnitude-Time
Version:
rev: 1.123 date: 2019/07/13 12:18:55
user: cg
file: AbstractTime.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

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.


Related information:

    Time
    Date
    Timestamp
    Delay
    ProcessorScheduler

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  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

instance creation
o  dateAndTimeNow
return an array filled with the current date and time.
As these provide no timezone info, this should be only used for user interface purposes.
See also: Date today / Time now / Timestamp now.

usage example(s):

     Time dateAndTimeNow       
     Date dateAndTimeNow       

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   
     Time now   

o  nowWithMicroseconds
return an instance of myself representing this moment with at least microsecond precision.

usage example(s):

     Timestamp now   
     Time now
     Timestamp nowWithMilliseconds
     Timestamp nowWithMicroseconds

o  nowWithMilliseconds
return an instance of myself representing this moment with at least millisecond precision.

usage example(s):

     Time now
     Time nowWithMilliseconds 

     Timestamp now   
     Timestamp nowWithMilliseconds
     Timestamp nowWithMicroseconds

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

** This method raises an error - it must be redefined in concrete classes **

misc ui support
o  iconInBrowserSymbol
( an extension from the stx:libtool package )
the browser will use this as index into the toolbariconlibrary

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

o  microsecondClockValue
return microseconds seconds of now

usage example(s):

     Time microsecondClockValue

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 raises an error - it must be redefined in concrete classes **

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]  


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  getHours
( an extension from the stx:libjavascript package )
return the hours (0..24)

usage example(s):

     JavaScriptParser
	evaluate:'Date.now.getHours;'

o  getMinutes
( an extension from the stx:libjavascript package )
return the minutes (0..60)

usage example(s):

     JavaScriptParser
	evaluate:'Date.now.getMinutes;'

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

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

o  js_getMilliseconds
( an extension from the stx:libjavascript package )
return the millieconds (0..999)

usage example(s):

     JavaScriptParser
	evaluate:'Date.now.js_getMilliseconds;'

o  js_getSeconds
( an extension from the stx:libjavascript package )
return the seconds (0..60)

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

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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.

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

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

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

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

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

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.
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.

o  roundTo: aTimeDuration
round the receiver to the next multiple of a TimeDuration

usage example(s):

      (TimeDuration fromMilliseconds:25234) roundTo:2 seconds
      Time now roundTo:10 minutes
      Timestamp now roundTo:10 minutes

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

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

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

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

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

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

o  truncateTo: aTimeDuration
truncate the receiver to the next multiple of a TimeDuration

usage example(s):

      (TimeDuration fromMilliseconds:25234) truncateTo:2 seconds
      Time now truncateTo:10 minutes
      Timestamp now truncateTo:10 minutes

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 before or the same time as the argument

usage example(s):

        (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):

        (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

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 raises an error - it must be redefined in concrete classes **

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  asSeconds
get the seconds since some point of time in the past.
For Time instances, this is the number of seconds elapsed since midnight;
For TimeDurations, that is the duration in seconds (truncated);
For TimeStamps, that is the number of seconds since the epoch

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 raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

o  asUtcTimestamp
represent myself as a timestamp in the local timezone

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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
private print support: add bindings for printing to aDictionary.
languageOrNil can be #en, #fr, #de or nil for the current language.
Here only basic bindings are added - no timezone am am/pm stuff,
which doesn't make sense for TimeDuration.

bindings:
%h hours, 00..23 (i.e. european) 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
%j microseconds, 000000..999999 0-padded to length 6

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
%M minutes - unpadded
%S seconds - unpadded
%I milliseconds, unpadded
%J microseconds, unpadded
%F subsecond fraction, unpadded with as many post-digits as appropriate
(i.e. for .1 , .01 , .001 etc.)

%t seconds within hour (unpadded)
%T seconds from midNight (unpadded)

%(milli) milliseconds unpadded - alias for %I for convenience
%(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, padded to 3 (same as %i for convenience)
%(milliF1) milliseconds + 1 digits of micros
%(milliF2) milliseconds + 2 digits of micros
%(milliF3) milliseconds + 3 digits of micros
%(milliF4) milliseconds + 4 digits of micros

%(micro) microseconds unpadded - alias for %J for convenience
%(micro6) microseconds, padded to 6 (same as %j for convenience)

%(nano) nanoseconds unpadded
%(nano9) nanoseconds, padded to 9

%(pico) picoseconds unpadded
%(pico12) picoseconds, padded to 12

%(fract) fraction part - as many as needed alias for %F 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')


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)'


o  addPrintBindingsTo: aDictionary

o  addPrintBindingsTo: aDictionary language: languageOrNil
private print support: add bindings for printing to aDictionary.
languageOrNil can be #en, #fr, #de or nil for the current language.

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 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)'


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 raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

o  printOn: aStream format: aFormatString
print using a format string;
See #addPrintBindingsTo:language: 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: languageString
print using a format string;
See #addPrintBindingsTo:language: 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 #addPrintBindingsTo:language: 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'       
     Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s'       
     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 #addPrintBindingsTo:language: for allowed format strings

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  additionalPicoseconds
return the additional picoseconds within the current second (0..999999999).
Here, assume that we have none

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

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

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 raises an error - it must be redefined in concrete classes **

o  speciesNew



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 26 Apr 2024 08:03:46 GMT