Bug 2316624 - dnf5 shows command timestamps in UTC instead of local time
Summary: dnf5 shows command timestamps in UTC instead of local time
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: rpm-software-management
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-10-05 11:53 UTC by Mike B.
Modified: 2025-05-10 13:33 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rpm-software-management dnf5 issues 2200 0 None open Display timestamps in local time zone, respecting TZ environment variable 2025-04-28 10:02:36 UTC

Description Mike B. 2024-10-05 11:53:11 UTC
On Fedora Workstation 41 Beta, up to date, dnf command timestamps (e.g. `dnf history list`) are displayed in UTC instead of local time.

Example:
________
$ timedatectl
               Local time: Sat 2024-10-05 14:11:07 EEST
           Universal time: Sat 2024-10-05 11:11:07 UTC
                 RTC time: Sat 2024-10-05 14:11:08
                Time zone: Europe/... (EEST, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: yes


$ sudo dnf install gedit
...
[7/7] Installing gedit-2:46.2-5.fc41.aarch64


$ dnf history info last
Transaction ID : 14
Begin time     : 2024-10-05 11:11:13
...
End time       : 2024-10-05 11:11:15
...
Status         : Ok
Releasever     : 41
Description    : dnf install gedit

Reproducible: Always

Steps to Reproduce:
1. Verify system time (e.g. `timedatectl`)
2. Run a dnf command (e.g. `dnf install <package>`)
3. Verify command timestamp (e.g. `dnf history list` or `dnf history info last`)

Actual Results:  
The begin and end time of the dnf command are displayed in UTC time.

Expected Results:  
The begin and end time of the dnf command are displayed in system (local) time.

Comment 1 Petr Pisar 2024-10-07 10:25:11 UTC
I confirm this bug.

Comment 2 Petr Pisar 2024-10-07 10:33:20 UTC
The implementation is in libdnf5::utils::string::format_epoch(). When fixing it, we will need to discriminate when to use UTC and when to a local time zone. Some invocations are used for producing JSON output.

Comment 3 M. Schlegel 2025-04-27 12:35:19 UTC
Seems like a good feature to me, "dnf history..." is being used from the future and using UTC I don't have to be concerned if I need to substract an hour or not due to that time in the past being in daylight standard or daylight savings time
But it is bad that it's not clearly marked, it should be:

$ dnf history info last
Transaction ID : 14
Begin time     : 2024-10-05 11:11:13 UTC
...
End time       : 2024-10-05 11:11:15 UTC
...
Status         : Ok
Releasever     : 41
Description    : dnf install gedit


Note You need to log in before you can comment on or make changes to this bug.