Xuanwo opened a new pull request, #8837:
URL: https://github.com/apache/opendal/pull/8837

   # Which issue does this PR close?
   
   N/A. The included regression test reproduces the defect.
   
   # Rationale for this change
   
   `Metadata::last_modified` was passed through the cxx bridge as an RFC 3339 
string. `parse_meta_data` parsed it with `sscanf` and passed the fields to 
`std::mktime`, which interprets them in the host's local timezone and drops the 
fractional second. On non-UTC hosts, `Stat()` returned an instant shifted by 
the UTC offset, so passing it back as `if_modified_since` / 
`if_unmodified_since` compared against a different instant than the service 
reported. Subsecond modification times were also truncated to whole seconds.
   
   # What changes are included in this PR?
   
   - Carry `last_modified` through the internal cxx bridge as 
`OptionalTimestamp` seconds plus nanoseconds, matching the existing 
`if_modified_since` / `if_unmodified_since` representation. The public 
`Metadata` C++ type is unchanged.
   - Convert the Rust `Timestamp` to a floor second and a non-negative 
nanosecond, so instants before the Unix epoch round-trip with 
`ToFfiOptionalTimestamp`.
   - Build the C++ `system_clock::time_point` directly from the FFI values and 
remove the local-timezone parse.
   - Add an `fs` regression test that pins a file mtime with a 123 ms fraction, 
runs under UTC+9, and checks both the exact `Stat` value and the 
`if_unmodified_since` round trip. The test build enables `services-fs`.
   - Add Rust unit tests for the seconds/nanoseconds conversion, including a 
pre-1970 timestamp.
   
   # Are there any user-facing changes?
   
   `Metadata::LastModified()` now reports the UTC instant returned by the 
service. Previously it was shifted by the host UTC offset and truncated to 
whole seconds. Passing the value back in `if_modified_since` / 
`if_unmodified_since` now targets the same instant.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: Pi (T3 Code)
   - Model: DeepSeek
   - Effort: max
   - Role: Implementation sub-agent. Reproduced the local-timezone shift and 
subsecond loss, implemented the FFI timestamp fix, added Rust and C++ 
regression tests, and ran the binding's formatting, clippy, CMake build, and 
test suites.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to