Time in scripts
StackState Self-hosted v5.0.x
Some scripting functions of StackState may accept a
Durationparameter, representing both a point in time and a range of time.
A time slice represents all ongoing transactions.
An instant can be specified in the following ways:
- As a natural number representing the time in milliseconds since the Unix epoch. Almost all StackState response that have a time field represent time in this way. Most nodes for example have a
lastUpdateTimestampfield that is represented in this way.
- As a string representing time according to a ISO8601 string of which nothing is ommitted. Must be of format:
- As a string representing relative time. Relative time string start with
-, followed by a natural number, followed by a time modifier (see section below).
Examples of valid instants:
A duration is specified as a natural number followed by a time modifier (see section below).
Examples of valid durations:
"3m"- 3 minutes
"1d"- 1 day
"9w"- 9 weeks
The following modifiers are usable for both
m- minutes (60 seconds)
h- hours (60 minutes)
d- days (24 hours)
w- weeks (7 days)