From a1349d877601df166a6b4bb8a1a38126802dcc9d Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 22 Sep 2024 00:08:07 -0400 Subject: [PATCH] fix vet warnings --- core/time/rfc3339.odin | 4 +++- tests/core/time/test_core_time.odin | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/time/rfc3339.odin b/core/time/rfc3339.odin index 9d816b3fa..20e8ea0bb 100644 --- a/core/time/rfc3339.odin +++ b/core/time/rfc3339.odin @@ -199,6 +199,8 @@ The boolean `ok` is false if the `time` is not a valid datetime, or if allocatin - `include_nanos`: whether to include nanoseconds in the result. */ time_to_rfc3339 :: proc(time: Time, utc_offset : int = 0, include_nanos := true, allocator := context.allocator) -> (res: string, ok: bool) { + utc_offset := utc_offset + // convert to datetime datetime := time_to_datetime(time) or_return @@ -276,7 +278,7 @@ time_to_rfc3339 :: proc(time: Time, utc_offset : int = 0, include_nanos := true, } else { temp_string[offset] = utc_offset > 0 ? '+' : '-' offset += 1 - utc_offset := abs(utc_offset) + utc_offset = abs(utc_offset) print_as_fixed_int(temp_string[:], &offset, 2, i64(utc_offset / 60)) temp_string[offset] = ':' offset += 1 diff --git a/tests/core/time/test_core_time.odin b/tests/core/time/test_core_time.odin index 23044b72f..424111aa3 100644 --- a/tests/core/time/test_core_time.odin +++ b/tests/core/time/test_core_time.odin @@ -202,7 +202,7 @@ test_print_rfc3339 :: proc(t: ^testing.T) { printed: string, time: i64, utc_offset: int, - }; + } tests :: [?]TestCase { {"1985-04-12T23:20:50.52Z", 482196050520000000, 0}, @@ -210,7 +210,7 @@ test_print_rfc3339 :: proc(t: ^testing.T) { {"1996-12-19T16:39:57-08:00", 851013597000000000, -480}, {"1996-12-20T00:39:57Z", 851042397000000000, 0}, {"1937-01-01T12:00:27.87+00:20", -1041335972130000000, +20}, - }; + } for test in tests { timestamp := time.Time { _nsec = test.time }