doc_comments.zig (666B) - Raw
1 /// A structure for storing a timestamp, with nanosecond precision (this is a 2 /// multiline doc comment). 3 const Timestamp = struct { 4 /// The number of seconds since the epoch (this is also a doc comment). 5 seconds: i64, // signed so we can represent pre-1970 (not a doc comment) 6 /// The number of nanoseconds past the second (doc comment again). 7 nanos: u32, 8 9 /// Returns a `Timestamp` struct representing the Unix epoch; that is, the 10 /// moment of 1970 Jan 1 00:00:00 UTC (this is a doc comment too). 11 pub fn unixEpoch() Timestamp { 12 return Timestamp{ 13 .seconds = 0, 14 .nanos = 0, 15 }; 16 } 17 }; 18 19 // syntax