| ... | @@ -233,6 +233,13 @@ pub const DateTime = struct { | ... | @@ -233,6 +233,13 @@ pub const DateTime = struct { |
| 233 | return res; | 233 | return res; |
| 234 | } | 234 | } |
| 235 | | 235 | |
| | 236 | pub fn to_timespec(self: DateTime) sys.struct_timespec { |
| | 237 | return .{ |
| | 238 | .sec = self.toUnix(), |
| | 239 | .nsec = self.ms * ns_per_ms, |
| | 240 | }; |
| | 241 | } |
| | 242 | |
| 236 | fn daysSinceEpoch(self: DateTime) u64 { | 243 | fn daysSinceEpoch(self: DateTime) u64 { |
| 237 | var res: u64 = 0; | 244 | var res: u64 = 0; |
| 238 | res += self.days; | 245 | res += self.days; |