fix: main() usage of instant
This commit is contained in:
parent
834d5b7f13
commit
518998fcd8
1 changed files with 10 additions and 7 deletions
17
src/main.zig
17
src/main.zig
|
|
@ -2,14 +2,17 @@ const std = @import("std");
|
|||
const Temporal = @import("temporalz");
|
||||
|
||||
pub fn main() !void {
|
||||
const result = try Temporal.Instant.init(1704067200000); // 2024-01-01 00:00:00 UTC
|
||||
const allocator = std.heap.page_allocator;
|
||||
const result = try Temporal.Instant.init(1_704_067_200_000_000_000); // 2024-01-01 00:00:00 UTC
|
||||
defer result.deinit();
|
||||
|
||||
std.debug.print("Instant with Epoch: {}ms\n", .{result.epoch});
|
||||
std.debug.print("Instant.epoch_milliseconds: {}\n", .{result.epoch_milliseconds});
|
||||
std.debug.print("Instant.epoch_nanoseconds: {}\n", .{result.epoch_nanoseconds});
|
||||
const instant_str = try result.toString(allocator, .{});
|
||||
std.debug.print("Instant.toString(): {s}\n", .{instant_str});
|
||||
|
||||
const cloned = result.clone();
|
||||
std.debug.print("Is Instant Equal: {}\n", .{cloned.equals(result)});
|
||||
|
||||
const instant_str = try cloned.toString(std.heap.page_allocator, .{});
|
||||
std.debug.print("Cloned Instant String: {s}\n", .{instant_str});
|
||||
const dur = try Temporal.Duration.from("P1Y2M3DT4H5M6S");
|
||||
defer dur.deinit();
|
||||
// const dur_str = try dur.toString(allocator, .{});
|
||||
// std.debug.print("Duration String: {s}\n", .{dur_str});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue