@@ -2023,7 +2023,7 @@ test "timestamp now() function" {
20232023
20242024 read_buffer = fixedBufferStream (& arr );
20252025 p = pack .init (& write_buffer , & read_buffer );
2026-
2026+
20272027 const decoded = try p .read (allocator );
20282028 defer decoded .free (allocator );
20292029
@@ -2054,48 +2054,48 @@ test "timestamp fromNanos() conversion" {
20542054 // Test with current time
20552055 const current_nanos = std .time .nanoTimestamp ();
20562056 const ts = msgpack .Timestamp .fromNanos (current_nanos );
2057-
2057+
20582058 // Verify seconds is reasonable (after 2020-01-01 and before 2100-01-01)
20592059 const year_2020 : i64 = 1577836800 ;
20602060 const year_2100 : i64 = 4102444800 ;
20612061 try expect (ts .seconds > year_2020 );
20622062 try expect (ts .seconds < year_2100 );
2063-
2063+
20642064 // Verify nanoseconds is in valid range
20652065 try expect (ts .nanoseconds >= 0 );
20662066 try expect (ts .nanoseconds <= 999_999_999 );
2067-
2067+
20682068 // Test with known values
20692069 const test_nanos : i128 = 1704067200_123456789 ; // 2024-01-01 00:00:00.123456789 UTC
20702070 const test_ts = msgpack .Timestamp .fromNanos (test_nanos );
20712071 try expect (test_ts .seconds == 1704067200 );
20722072 try expect (test_ts .nanoseconds == 123456789 );
2073-
2073+
20742074 // Test with negative timestamp (before Unix epoch)
20752075 const negative_nanos : i128 = -1000000_500000000 ; // -1000000 seconds + 0.5 seconds
20762076 const negative_ts = msgpack .Timestamp .fromNanos (negative_nanos );
20772077 try expect (negative_ts .seconds == -1000001 );
20782078 try expect (negative_ts .nanoseconds == 500000000 );
2079-
2079+
20802080 // Test Payload.timestampFromNanos() convenience method
20812081 const payload = msgpack .Payload .timestampFromNanos (current_nanos );
20822082 try expect (payload == .timestamp );
20832083 try expect (payload .timestamp .seconds == ts .seconds );
20842084 try expect (payload .timestamp .nanoseconds == ts .nanoseconds );
2085-
2085+
20862086 // Test serialization and deserialization
20872087 try p .write (payload );
2088-
2088+
20892089 read_buffer = fixedBufferStream (& arr );
20902090 p = pack .init (& write_buffer , & read_buffer );
20912091
20922092 const decoded = try p .read (allocator );
20932093 defer decoded .free (allocator );
2094-
2094+
20952095 try expect (decoded == .timestamp );
20962096 try expect (decoded .timestamp .seconds == ts .seconds );
20972097 try expect (decoded .timestamp .nanoseconds == ts .nanoseconds );
2098-
2098+
20992099 // Test that the toFloat() method works correctly
21002100 const float_original = ts .toFloat ();
21012101 const float_decoded = decoded .timestamp .toFloat ();
0 commit comments