Skip to content

Time

Time can represent a single point in time (unix time) or a duration both positive and negative. It is backed by a 128bit integer that counts the total number of ticks and can represent a range of [-5, +5] eons with an accuracy of 1 zeptosecond (10^-21).

graph BT
N1["Time"] -->|inherits| N2["Stringable"];
N2["Stringable"] -->|inherits| N3["Any"];

Characteristics

Quality Value
Inherits Stringable
Extends N/A
Decorators N/A
Is enum false
Is sealed false
Is extern false
Is abstract false
Is generator false
Has value semantics true
Has stored properties true
Should register destructor false
Has atomic memory true
Is copy assignable true
Is zero initializable true

Const Expressions

kZeptosInSecond

const! kZeptosInSecond = 1000000000000000000000 Int128

kAttosInSecond

const! kAttosInSecond = 1000000000000000000 Int128

kFemtosInSecond

const! kFemtosInSecond = 1000000000000000 Int128

kPicosInSecond

const! kPicosInSecond = 1000000000000 Int128

kNanosInSecond

const! kNanosInSecond = 1000000000 Int128

kMicrosInSecond

const! kMicrosInSecond = 1000000 Int128

kMillisInSecond

const! kMillisInSecond = 1000 Int128

kSecondsInMinute

const! kSecondsInMinute = 60 Int128

kMinutesInHour

const! kMinutesInHour = 60 Int128

kHoursInDay

const! kHoursInDay = 24 Int128

kDaysInYear

const! kDaysInYear = 365 Int128

kYearsInEon

const! kYearsInEon = 1000000000 Int128

kMetricStep

const! kMetricStep = 1000 Int128

kZeptosShift

const! kZeptosShift = 1 Int128

kAttosShift

const! kAttosShift = 1000 Int128

kFemtosShift

const! kFemtosShift = 1000000 Int128

kPicosShift

const! kPicosShift = 1000000000 Int128

kNanosShift

const! kNanosShift = 1000000000000 Int128

kMicrosShift

const! kMicrosShift = 1000000000000000 Int128

kMillisShift

const! kMillisShift = 1000000000000000000 Int128

kSecondsShift

const! kSecondsShift = 1000000000000000000000 Int128

kMinutesShift

const! kMinutesShift = 60000000000000000000000 Int128

kHoursShift

const! kHoursShift = 3600000000000000000000000 Int128

kDaysShift

const! kDaysShift = 86400000000000000000000000 Int128

kWeeksShift

const! kWeeksShift = 604800000000000000000000000 Int128

kSemestersShift

const! kSemestersShift = 10886400000000000000000000000 Int128

kYearsShift

const! kYearsShift = 31536000000000000000000000000 Int128

kDecadesShift

const! kDecadesShift = 315360000000000000000000000000 Int128

kCenturiesShift

const! kCenturiesShift = 3153600000000000000000000000000 Int128

kMillenniaShift

const! kMillenniaShift = 31536000000000000000000000000000 Int128

kEonsShift

const! kEonsShift = 31536000000000000000000000000000000000 Int128

Functions

now

#Gambol.function.nounwind
#Gambol.function.alwaysinline
now () -> Time
returns the unix time representing the system wall clock


checkpoint

#Gambol.function.nounwind
#Gambol.function.alwaysinline
checkpoint () -> Time
uses the system's stable and monotonically increasing clock to acquire a timepoint representing the current time. This is meant for use in benchmarks rather than figuring out the current wall clock time.


min

#Gambol.function.nounwind
min () -> Time
minimum time that can be represented with this type


max

#Gambol.function.nounwind
max () -> Time
maximum time that can be represented with this type


Methods

construct

#default
#Gambol.function.alwaysinline
construct (s @Self) -> Self

sign

#Gambol.function.nounwind
sign (s @Self) -> Int128
1 if positive, -1 if negative and 0 otherwise


abs

#Gambol.function.nounwind
abs (s @Self) -> Time
returns the absolute value of self


str

str (s @Self) -> String

zeptos

#Gambol.function.nounwind
zeptos (s @Self, v Int128 = 0) -> Self
adds v zeptoseconds to self


zeptos_only

#Gambol.function.nounwind
zeptos_only (s @Self) -> Int128
returns the zeptoseconds fraction of self only


total_zeptos

#Gambol.function.nounwind
total_zeptos (s @Self) -> Int128
returns self in zeptoseconds


frac_zeptos

#Gambol.function.nounwind
frac_zeptos (s @Self) -> Int128
returns the fractional part of self after seconds with zeptosecond accuracy


attos

#Gambol.function.nounwind
attos (s @Self, v Int128 = 0) -> Self
adds v attoseconds to self


attos_only

#Gambol.function.nounwind
attos_only (s @Self) -> Int128
returns the attoseconds fraction of self only


total_attos

#Gambol.function.nounwind
total_attos (s @Self) -> Int128
returns self in attoseconds


frac_attos

#Gambol.function.nounwind
frac_attos (s @Self) -> Int128
returns the fractional part of self after seconds with attosecond accuracy


femtos

#Gambol.function.nounwind
femtos (s @Self, v Int128 = 0) -> Self
adds v femtoseconds to self


femtos_only

#Gambol.function.nounwind
femtos_only (s @Self) -> Int128
returns the femtoseconds fraction of self only


total_femtos

#Gambol.function.nounwind
total_femtos (s @Self) -> Int128
returns self in femtoseconds


frac_femtos

#Gambol.function.nounwind
frac_femtos (s @Self) -> Int128
returns the fractional part of self after seconds with femtosecond accuracy


picos

#Gambol.function.nounwind
picos (s @Self, v Int128 = 0) -> Self
adds v picoseconds to self


picos_only

#Gambol.function.nounwind
picos_only (s @Self) -> Int128
returns the picoseconds fraction of self only


total_picos

#Gambol.function.nounwind
total_picos (s @Self) -> Int128
returns self in picoseconds


frac_picos

#Gambol.function.nounwind
frac_picos (s @Self) -> Int128
returns the fractional part of self after seconds with picosecond accuracy


nanos

#Gambol.function.nounwind
nanos (s @Self, v Int128 = 0) -> Self
adds v nanoseconds to self


nanos_only

#Gambol.function.nounwind
nanos_only (s @Self) -> Int128
returns the nanoseconds fraction of self only


total_nanos

#Gambol.function.nounwind
total_nanos (s @Self) -> Int128
returns self in nanoseconds


frac_nanos

#Gambol.function.nounwind
frac_nanos (s @Self) -> Int128
returns the fractional part of self after seconds with nanosecond accuracy


micros

#Gambol.function.nounwind
micros (s @Self, v Int128 = 0) -> Self
adds v microseconds to self


micros_only

#Gambol.function.nounwind
micros_only (s @Self) -> Int128
returns the microseconds fraction of self only


total_micros

#Gambol.function.nounwind
total_micros (s @Self) -> Int128
returns self in microseconds


frac_micros

#Gambol.function.nounwind
frac_micros (s @Self) -> Int128
returns the fractional part of self after seconds with microsecond accuracy


millis

#Gambol.function.nounwind
millis (s @Self, v Int128 = 0) -> Self
adds v milliseconds to self


millis_only

#Gambol.function.nounwind
millis_only (s @Self) -> Int128
returns the milliseconds fraction of self only


total_millis

#Gambol.function.nounwind
total_millis (s @Self) -> Int128
returns self in milliseconds


frac_millis

#Gambol.function.nounwind
frac_millis (s @Self) -> Int128
returns the fractional part of self after seconds with millisecond accuracy


seconds

#Gambol.function.nounwind
seconds (s @Self, v Int128 = 0) -> Self
adds v seconds to self


seconds_only

#Gambol.function.nounwind
seconds_only (s @Self) -> Int128
returns the seconds in a minute fraction of self only


total_seconds

#Gambol.function.nounwind
total_seconds (s @Self) -> Int128
returns self in seconds


minutes

#Gambol.function.nounwind
minutes (s @Self, v Int128 = 0) -> Self
adds v minutes to self


minutes_only

#Gambol.function.nounwind
minutes_only (s @Self) -> Int128
returns the minutes in an hour fraction of self only


total_minutes

#Gambol.function.nounwind
total_minutes (s @Self) -> Int128
returns self in minutes


hours

#Gambol.function.nounwind
hours (s @Self, v Int128 = 0) -> Self
adds v hours to self


hours_only

#Gambol.function.nounwind
hours_only (s @Self) -> Int128
returns the hours in a day fraction of self only


total_hours

#Gambol.function.nounwind
total_hours (s @Self) -> Int128
returns self in hours


days

#Gambol.function.nounwind
days (s @Self, v Int128 = 0) -> Self
adds v days to self


days_only

#Gambol.function.nounwind
days_only (s @Self) -> Int128
returns the days in a year fraction of self only


total_days

#Gambol.function.nounwind
total_days (s @Self) -> Int128
returns self in days


weeks

#Gambol.function.nounwind
weeks (s @Self, v Int128 = 0) -> Self
adds v weeks to self


total_weeks

#Gambol.function.nounwind
total_weeks (s @Self) -> Int128
returns self in weeks


semesters

#Gambol.function.nounwind
semesters (s @Self, v Int128 = 0) -> Self
adds v semesters to self


total_semesters

#Gambol.function.nounwind
total_semesters (s @Self) -> Int128
returns self in semesters


years

#Gambol.function.nounwind
years (s @Self, v Int128 = 0) -> Self
adds v years to self


years_only

#Gambol.function.nounwind
years_only (s @Self) -> Int128
returns the years in an eon fraction of self only


total_years

#Gambol.function.nounwind
total_years (s @Self) -> Int128
returns self in years


decades

#Gambol.function.nounwind
decades (s @Self, v Int128 = 0) -> Self
adds v decades to self


total_decades

#Gambol.function.nounwind
total_decades (s @Self) -> Int128
returns self in decades


centuries

#Gambol.function.nounwind
centuries (s @Self, v Int128 = 0) -> Self
adds v centuries to self


total_centuries

#Gambol.function.nounwind
total_centuries (s @Self) -> Int128
returns self in centuries


millennia

#Gambol.function.nounwind
millennia (s @Self, v Int128 = 0) -> Self
adds v millennia to self


total_millennia

#Gambol.function.nounwind
total_millennia (s @Self) -> Int128
returns self in millennia


eons

#Gambol.function.nounwind
eons (s @Self, v Int128 = 0) -> Self
adds v eons to self


total_eons

#Gambol.function.nounwind
total_eons (s @Self) -> Int128
returns self in eons


Unary Operators

-

#Gambol.function.nounwind
- (s @Self) -> Time

Binary Operators

=

#default
#Gambol.function.nounwind
= (s @Self, o @Self) -> Self

==

#Gambol.function.nounwind
== (s @Self, o @Self) -> Bool

<

#Gambol.function.nounwind
< (s @Self, o @Self) -> Bool

<=

#Gambol.function.nounwind
<= (s @Self, o @Self) -> Bool

>

#Gambol.function.nounwind
> (s @Self, o @Self) -> Bool

>=

#Gambol.function.nounwind
>= (s @Self, o @Self) -> Bool

+

#Gambol.function.nounwind
+ (s @Self, o @Self) -> Time

+=

#Gambol.function.nounwind
+= (s @Self, o @Self) -> Self

-

#Gambol.function.nounwind
- (s @Self, o @Self) -> Time

-=

#Gambol.function.nounwind
-= (s @Self, o @Self) -> Self

*

#Gambol.function.nounwind
* (s @Self, o Int128) -> Time

*=

#Gambol.function.nounwind
*= (s @Self, o Int128) -> Self

/

#Gambol.function.nounwind
/ (s @Self, o Int128) -> Time

/=

#Gambol.function.nounwind
/= (s @Self, o Int128) -> Self

%

#Gambol.function.nounwind
% (s @Self, o @Self) -> Time

%=

#Gambol.function.nounwind
%= (s @Self, o @Self) -> Self

Casts To

  • Bool

Properties

total_ticks

total_ticks Int128