Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303208

JFR: 'jfr print' displays incorrect timestamps

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 21
    • 20, 21
    • 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.

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

              Created:
              Updated:
              Resolved: