The JFR API provides meant to get a java.time.Instant (UTC) from a field in a RecordedEvent. The file format stores the time zone offset, but it's currently not exposed.
When visualising events, it's sometimes desirable to do it in the time zone where the event was recorded. One of the benefit of using OffsetDateTime is that it can easily be converted to other representations.
toLocalDateTime()
toLocalTime()
toInstant()
toOffsetTime()
toZonedDateTime()
OffsetDateTime is probably what makes the most sense to use when serializing data, for example to a database. The 'jfr' command line tool writes timestamps in JSON and XML using a package private version of RecordedObject::getOffsetDateTime(String).
By making the method public, tools outside the JDK could get access to the same information.
When visualising events, it's sometimes desirable to do it in the time zone where the event was recorded. One of the benefit of using OffsetDateTime is that it can easily be converted to other representations.
toLocalDateTime()
toLocalTime()
toInstant()
toOffsetTime()
toZonedDateTime()
OffsetDateTime is probably what makes the most sense to use when serializing data, for example to a database. The 'jfr' command line tool writes timestamps in JSON and XML using a package private version of RecordedObject::getOffsetDateTime(String).
By making the method public, tools outside the JDK could get access to the same information.