JFR: 'jfr print' displays incorrect timestamps

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 21
    • Affects Version/s: 20, 21
    • Component/s: hotspot
    • None
    • jfr
    • b12

      Timestamps printed by 'jfr print' are one hour off, at least in CET. Reproducer:

      $ java -XX:StartFlightRecording:filename=recording.jfr -version
      $ jfr print recording.jfr

      The problem is that DST is included even when it's not in effect.

      TimeZone.getDefault().useDaylightTime()

      returns true in February 25, which leads to an additional one hour (besides offset to UTC). The pretty printer uses RecordedObject::getOffsetDateTime(String) (not exposed in public API), which is based on a two hour offset instead of one.

      The following code fixes the problem:

      if (TimeZone.getDefault().inDaylightTime(new Date())) {
         dst = TimeZone.getDefault().getDSTSavings();
      } else {
        dst = 0;
      }

      I would prefer to use java.time API, but not sure how to get the information splitted into GMT offset and DST, which happens to be how old JDK releases read newer recordings.

            Assignee:
            Erik Gahlin
            Reporter:
            Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: