Timestamp
classin packageklyn.time
public class Timestamp extends Object implements ValueType:
└ Timestamp
All Implemented Interfaces: ValueType
Represents a point in time, typically expressed as the number of seconds since the Epoch (January 1st, 1970, 00:00:00 UTC). This class extends the Double class to provide timestamp functionality. It includes methods to get the current timestamp, convert to DateTime, and provide a string representation.
import klyn.time

timestamp = Timestamp.now
print(timestamp)  # Output: Timestamp(1693459200.0)
@since 1.0
Properties
Modifier and Type Member Description
public static readonly property now
now as Timestamp:
Returns the current time in seconds since the Epoch (January 1st, 1970, 00:00:00 UTC).
public readonly property totalSeconds
totalSeconds as Double:
Total seconds since Unix epoch.
Properties inherited from Object: type
Constructors
Modifier and Type Member Description
public Timestamp
Timestamp(seconds as Double = 0.0):
Constructs a Timestamp object with a given value.
Methods
Modifier and Type Member Description
public toDateTime
toDateTime(timeZone as TimeZone = TimeZone.UTC) as DateTime:
Converts this Timestamp to a DateTime object.
public override toString
toString() as String:
Returns a string representation of this Timestamp object.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Operators
Modifier and Type Member Description
public static operator+(first as Timestamp, duration as Duration) as Timestamp: No summary.
public static operator-(first as Timestamp, duration as Duration) as Timestamp: No summary.
public static operator-(first as Timestamp, second as Timestamp) as Duration: No summary.