Back: DLD class-dynamic linking Up: Base classes Forward: Duration class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.67 Duration

Defined in namespace Smalltalk
Superclass: Time
Category: Language-Data types
My instances represent differences between timestamps.

1.67.1 Duration class: instance creation  (class)
1.67.2 Duration class: instance creation (non ANSI)  (class)
1.67.3 Duration: arithmetics  (instance)
1.67.4 Duration: processes  (instance)
1.67.5 Duration: storing  (instance)


1.67.1 Duration class: instance creation

days: d
Answer a duration of `d' days

days: d hours: h minutes: m seconds: s
Answer a duration of `d' days and the given number of hours, minutes, and seconds.

initialize
Initialize the receiver's instance variables

milliseconds: msec
Answer a duration of `msec' milliseconds

readFrom: aStream
Parse an instance of the receiver (hours/minutes/seconds) from aStream

weeks: w
Answer a duration of `w' weeks

zero
Answer a duration of zero seconds.


1.67.2 Duration class: instance creation (non ANSI)

fromDays: days seconds: secs offset: unused
Answer a duration of `d' days and `secs' seconds. The last parameter is unused; this message is available for interoperability with the DateTime class.


1.67.3 Duration: arithmetics

* factor
Answer a Duration that is `factor' times longer than the receiver

+ aDuration
Answer a Duration that is the sum of the receiver and aDuration's lengths.

- aDuration
Answer a Duration that is the difference of the receiver and aDuration's lengths.

/ factorOrDuration
If the parameter is a Duration, answer the ratio between the receiver and factorOrDuration. Else divide the receiver by factorOrDuration (a Number) and answer a new Duration that is correspondingly shorter.

abs
Answer a Duration that is as long as the receiver, but always in the future.

days
Answer the number of days in the receiver

isZero
Answer whether the receiver correspond to a duration of zero seconds.

negated
Answer a Duration that is as long as the receiver, but with past and future exchanged.

negative
Answer whether the receiver is in the past.

positive
Answer whether the receiver is a zero-second duration or is in the future.

printOn: aStream
Print a represention of the receiver on aStream.


1.67.4 Duration: processes

wait
Answer a Delay waiting for the amount of time represented by the receiver and start waiting on it.


1.67.5 Duration: storing

storeOn: aStream
Store on aStream Smalltalk code compiling to the receiver



Back: Duration-processes Up: Duration Forward: DynamicVariable   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html