Squeak Class Documentation category index | class index  
 
Time
  category: Kernel-Magnitudes
  superclass: Magnitude
  subclasses:

I represent the time of day.

Internally I store the number of seconds since midnight.

instance methods
  accessing
  hours
minutes
seconds

  arithmetic
  addTime:
subtractTime:

  comparing
  <
=
hash

  converting
  asSeconds

  printing
  hhmm24
intervalString
print24
print24:on:
print24:showSeconds:on:
printMinutes
printOn:
storeOn:

  private
  hours:
hours:minutes:seconds:
setSeconds:

class methods
  benchmarks
  benchmarkMillisecondClock
benchmarkPrimitiveResponseDelay

  general inquiries
  condenseBunches:
dateAndTimeFromSeconds:
dateAndTimeNow
humanWordsForSecondsAgo:
millisecondClockValue
milliseconds:since:
millisecondsSince:
millisecondsToRun:
namesForTimes:
totalSeconds

  instance creation
  fromSeconds:
new
now
readFrom:

  private
  primMillisecondClock
primSecondsClock

instance methods
  accessing top  
 

hours

Answer the number of hours the receiver represents.


 

minutes

Answer the number of minutes the receiver represents.


 

seconds

Answer the number of seconds the receiver represents.


  arithmetic top  
 

addTime:

Answer a Time that is timeInterval after the receiver. timeInterval is an
instance of Date or Time.


 

subtractTime:

Answer a Time that is timeInterval before the receiver. timeInterval is
an instance of Date or Time.


  comparing top  
 

<

Answer whether aTime is earlier than the receiver.


 

=

Answer whether aTime represents the same second as the receiver.


 

hash

Hash must be redefined since = was redefined.


  converting top  
 

asSeconds

Answer the number of seconds since midnight of the receiver.


  printing top  
 

hhmm24

Return a string of the form 1123 (for 11:23 am), 2154 (for 9:54 pm), of exactly 4 digits


 

intervalString

Treat the time as a difference. Give it in hours and minutes with two digits of accuracy.


 

print24

Return as 8-digit string 'hh:mm:ss', with leading zeros if needed


 

print24:on:

Format is 'hh:mm:ss' or 'h:mm:ss am'


 

print24:showSeconds:on:

Format is 'hh:mm:ss' or 'h:mm:ss am' or, if showSeconds is false, 'hh:mm' or 'h:mm am'


 

printMinutes

Return as string 'hh:mm pm'


 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


 

storeOn:

Append to the argument aStream a sequence of characters that is an
expression whose evaluation creates an object similar to the receiver.


  private top  
 

hours:


 

hours:minutes:seconds:


 

setSeconds:


class methods
  benchmarks top  
 

benchmarkMillisecondClock

Benchmark the time spent in a call to Time>>millisecondClockValue.
On the VM level this tests the efficiency of calls to ioMSecs().
Time benchmarkMillisecondClock
PII/400 Windows 98: 0.725 microseconds per call


 

benchmarkPrimitiveResponseDelay

Benchmark the overhead for primitive dispatches with an active Delay.
On the VM level, this tests the efficiency of ioLowResMSecs.
Time benchmarkPrimitiveResponseDelay
PII/400 Windows98: 0.128 microseconds per prim


  general inquiries top  
 

condenseBunches:

Identify the major intervals in a bunch of numbers. Each number is a seconds since 1901 that represents a date and time. We want the last event in a bunch. Return array of seconds for:
Every event in the last half hour.
Every bunch separated by 30 min in the last 24 hours.
Every bunch separated by two hours before that.


 

dateAndTimeFromSeconds:


 

dateAndTimeNow

Answer a two-element Array of (Date today, Time now).


 

humanWordsForSecondsAgo:

Return natural language for this date and time in the past.


 

millisecondClockValue

Answer the number of milliseconds since the millisecond clock was last
reset or rolled over.


 

milliseconds:since:

Answer the elapsed time since last recorded in milliseconds.
Compensate for rollover.


 

millisecondsSince:

Answer the elapsed time since last recorded in milliseconds.
Compensate for rollover.


 

millisecondsToRun:

Answer the number of milliseconds timedBlock takes to return its value.


 

namesForTimes:

Return English descriptions of the times in the array. They are each seconds since 1901. If two names are the same, append the date and time to distinguish them.


 

totalSeconds

Answer the total seconds from January 1, 1901.


  instance creation top  
 

fromSeconds:

Answer an instance of me that is secondCount number of seconds since midnight.


 

new

Return a constant, or Time now?


 

now

Answer an instnace of me representing the time right now--this is a 24
hour clock.


 

readFrom:

Read a Time from the stream in the form:
<hour>:<minute>:<second> <am/pm>

<minute>, <second> or <am/pm> may be omitted. e.g. 1:59:30 pm; 8AM; 15:30


  private top  
 

primMillisecondClock

Primitive. Answer the number of milliseconds since the millisecond clock
was last reset or rolled over. Answer zero if the primitive fails.
Optional. See Object documentation whatIsAPrimitive.


 

primSecondsClock

Answer the number of seconds since 00:00 on the morning of
January 1, 1901 (a 32-bit unsigned number).
Essential. See Object documentation whatIsAPrimitive.