Skip to content

Commit da5ee80

Browse files
committed
feat(cmd2): use 0.01s precision for bottom toolbar timestamp
Updated Cmd._bottom_toolbar to format the current time with 0.01s precision (two decimal places for fractional seconds). Maintained the ISO-like format including the timezone offset.
1 parent 1607598 commit da5ee80

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cmd2/cmd2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,9 @@ def _bottom_toolbar(self) -> Any:
16331633
import datetime
16341634
import shutil
16351635

1636-
# Get the current time in ISO format
1637-
now = datetime.datetime.now(datetime.timezone.utc).astimezone().isoformat()
1636+
# Get the current time in ISO format with 0.01s precision
1637+
dt = datetime.datetime.now(datetime.timezone.utc).astimezone()
1638+
now = dt.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-4] + dt.strftime('%z')
16381639
left_text = sys.argv[0]
16391640

16401641
# Get terminal width to calculate padding for right-alignment

0 commit comments

Comments
 (0)