shunping commented on PR #30758: URL: https://github.com/apache/beam/pull/30758#issuecomment-2099138963
Here is a little more deep dive on the code regarding @Abacn 's test case.
- `Instant.now()` returns an `Instant` object with a timezone set to UTC.
When we call `DateTime(Instant)`, it uses this as the timezone. That's why
`dt2` is shown as `2024-05-07T17:54:06.250Z`
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/Instant.java#L80
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/Instant.java#L304
- `Datetime(long)` initiate `DateTime` object in the default timezone. The
default timezone for this is UTC-4, so `dt1` is shown as
`2024-05-07T13:54:06.250-04:00`.
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/DateTime.java#L210
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/base/BaseDateTime.java#L97
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/chrono/ISOChronology.java#L79
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/DateTimeZone.java#L164
- Similarly, `Instant.toDateTime()` also use the default timezone, and thus
`dt3` is also `2024-05-07T13:54:06.250-04:00`.
-
https://github.com/JodaOrg/joda-time/blob/4a1402a47cab4636bf4c73d42a62bfa80c1535ca/src/main/java/org/joda/time/Instant.java#L326
--
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]
