Pike v8.1 release 6

Class Calendar.Time.Fraction

Inheritance graph
Description

A Fraction is a part of a second, and/or a time period with higher resolution then a second.

It contains everything that is possible to do with a Second, and also some methods of grabbing the time period with higher resolution.

Note

Internally, the fraction time period is measured in nanoseconds. A shorter or more precise time period then in nanoseconds is not possible within the current Fraction class.


Inherit Second

inherit Second : Second


Method create

Calendar.Time.Fraction Calendar.Time.Fraction()
Calendar.Time.Fraction Calendar.Time.Fraction("unix", int|float unixtime)
Calendar.Time.Fraction Calendar.Time.Fraction("unix", int|float unixtime, int|float len)
Calendar.Time.Fraction Calendar.Time.Fraction(int y, int m, int d, int h, int m, int s, int ns)

Description

It is possible to create a Fraction in three ways, either "now" with no arguments or from a unix time (as from time(2)), or the convenience way from ymd-hms integers.

If created from unix time, both the start of the period and the size of the period can be given in floats, both representing seconds. Note that the default float precision in pike is rather low (same as 'float' in C, the 32 bit floating point precision, normally about 7 digits), so beware that the resolution might bite you. (Internally in a Fraction, the representation is an integer.)

If created without explicit length, the fraction will always be of zero length.