2024-04-25 01:41:47 +01:00
|
|
|
/// A structure for storing a timestamp, with nanosecond precision (this is a
|
|
|
|
/// multiline doc comment).
|
|
|
|
const Timestamp = struct {
|
|
|
|
/// The number of seconds since the epoch (this is also a doc comment).
|
2024-05-04 19:29:17 +01:00
|
|
|
seconds: i64, // signed so we can represent pre-1970 (not a doc comment)
|
2024-04-25 01:41:47 +01:00
|
|
|
/// The number of nanoseconds past the second (doc comment again).
|
|
|
|
nanos: u32,
|
|
|
|
|
|
|
|
/// Returns a `Timestamp` struct representing the Unix epoch; that is, the
|
|
|
|
/// moment of 1970 Jan 1 00:00:00 UTC (this is a doc comment too).
|
|
|
|
pub fn unixEpoch() Timestamp {
|
|
|
|
return Timestamp{
|
|
|
|
.seconds = 0,
|
|
|
|
.nanos = 0,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// syntax
|