Skip to content

Leading zeros are stripped from Serial Monitor timestamps #580

Closed
@per1234

Description

@per1234

Describe the problem

🐛 The timestamps produced by the Serial Monitor have a non-standard format resulting from stripping the leading zeros from the hours and minutes.

🐛 This is not even done consistently as the leading zeros are preserved for seconds.

To Reproduce

Steps to reproduce the behavior:

  1. Upload a sketch to an Arduino board that periodically prints to the serial port. For example:
    void setup() {
      Serial.begin(9600);
    }
    void loop() {
      Serial.println("hello");
      delay(1000);
    }
  2. Select Tools > Serial Monitor from the Arduino IDE menus.
  3. Click the 🕙 icon ("Toggle Timestamp") that is near the top right corner of the output panel
  4. Wait for a time that contains a second less than 10.
  5. Look at the Serial Monitor output pane.
    🙂 Note that the leading zero on the second component of the time has not been removed.
  6. Wait for a time that contains a minute less than 10.
  7. Look at the Serial Monitor output pane.
    🐛 Note that the leading zero on the minute component of the time has been removed.
  8. Wait for a time that contains an hour less than 10.
  9. Look at the Serial Monitor output pane.
    🐛 Note that the leading zero on the hour component of the time has been removed.
23:59:58.610 -> hello
23:59:59.609 -> hello
0:0:00.620 -> hello
0:0:01.618 -> hello
0:0:02.630 -> hello

Expected behavior

Serial Monitor timestamps to be formatted the same as they were in the classic Arduino IDE:
hh:mm:ss.sss

00:05:02.590 -> hello

Arduino IDE version

Original report

2.0.0-beta.12-nightly.20211028

Last verified with

2.0.0-rc9-snapshot-5087ff0

Operating system

Windows 10

Additional context

Originally reported at:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions