|
|
Class: Time
Object
|
+--Magnitude
|
+--AbstractTime
|
+--Time
|
+--TimeDuration
- Package:
- stx:libbasic
- Category:
- Magnitude-Time
- Version:
- rev:
1.87
date: 2010/03/31 09:39:45
- user: stefan
- file: Time.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
Instances of time represent a particular time-of-day.
Since they only store hours, minutes and seconds within a day,
they cannot be used to compare times across midnight
(i.e. they should not be used as timeStamps).
Use instances of Timestamp (and read the comment there) to do this.
Examples:
|t|
t := Time now.
Transcript showCR:t.
|t1 t2|
t1 := Time now.
(Delay forSeconds:10) wait.
t2 := Time now.
t2 - t1
Date
Timestamp
AbstractTime
OperatingSystem
Filename
format strings
-
formatString12us
-
return the format string used to format US times (and other areas)
-
formatString24
-
return the format string used to format non US times
instance creation
-
hour: h minute: m
-
compatibility
-
hour: h minute: m second: s
-
compatibility
-
hour: h minutes: m seconds: s
-
return an instance of Time representing the given time.
See also Time now / Date today / Timestamp now.
Obsolete: please use #hours:minutes:seconds:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
hours: h minutes: m seconds: s
-
return an instance of Time representing the given time.
See also Time now / Date today / Timestamp now.
-
midnight
-
Answer a new instance at midnight.
-
noon
-
Answer a new instance at noon.
-
readFrom: aStringOrStream onError: exceptionBlock
-
return a new Time, reading a printed representation from aStream.
If no am/pm follows the time, the string is interpreted as
either 24 hour format or being am.
Compatibility-Squeak
-
intervalString
-
Treat the time as a difference.
Give it in hours and minutes with two digits of accuracy.
-
print24: prnt24FormatBoolean on: aStream
-
print me either US or 24hr format on a stream
-
print24: prnt24Format showSeconds: doSeconds on: aStream
-
print me either US or 24hr format, optionally with
seconds on a stream
accessing
-
hours
-
return the number of hours since midnight (i.e. 0..23)
-
milliseconds
-
time does not keep milliseconds
- for compatibility with Timestamp
-
minutes
-
return the number of minutes within the hour (i.e. 0..59)
-
seconds
-
return the number of seconds within the minute (i.e. 0..59)
-
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.
Time is local time, so answer the delta of today
comparing
-
< aTime
-
return true if the receiver is before the argument
-
= aTime
-
return true if the argument, aTime represents the same timeOfDay
-
> aTime
-
return true if the receiver is before the argument
-
hash
-
return an integer useful for hashing on times
converting
-
asNative
-
-
asSeconds
-
return the number of seconds elapsed since midnight
-
asTime
-
return a Time object from the receiver - thats the receiver.
-
asTimeDuration
-
return an TimeDuration object from the receiver, taking the time since midnight.
-
asTimestamp
-
return an Timestamp object from the receiver.
The date components are taken from today.
printing & storing
-
print12HourFormatOn: aStream
-
append a human readable printed representation of the receiver to aStream.
Format is hh:mm:ss am/pm (i.e. 12-hour american format).
-
print24HourFormatOn: aStream
-
append a human readable printed representation of the receiver to aStream.
Format is hh:mm:ss (i.e. 24-hour european format).
-
printOn: aStream
-
append a human readable printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
Format is hh:mm:ss either in 12-hour or 24-hour format.
depending on the setting of LanguageTerritory.
I dont know what ST-80 does here (12-hour format ?)
-
printString12HourFormat
-
return a printed representation in 12 hour format
-
printString24HourFormat
-
return a printed representation in 24 hour format
-
shortPrintString
-
dummy - for now
private
-
fromOSTime: osTime
-
set my time, given an osTime
-
getMilliseconds
-
return the number of milliseconds since midnight
-
getSeconds
-
return the number of seconds since midnight
-
setHours: h minutes: m seconds: s
-
set my time given individual values
-
setMilliseconds: millis
-
set my time given milliseconds since midnight
-
setSeconds: secs
-
set my time given seconds since midnight.
Notice the modulo operations here - there cannot be a time beyond 24hours
(use TimeDuration, if you need that).
-
timeEncoding
-
the internal encoding is stricktly private,
and should not be used outside.
-
timeEncoding: encoding
-
the internal encoding is stricktly private,
and should not be used outside.
|