du --time reports wrong time

Bug #1617234 reported by Alun Perkins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

expect
du --time --time-style=+%s theFile
to give modification time of theFile expressed as seconds since the epoch.
Comparison to "date" shows that du is reporting the time wrongly.
This script:

echo "my time and time zone:" $(date)
touch timestampTest
echo "date says: " $(date -r timestampTest +%s)
echo "du says:" $(du --time --time-style=+%s timestampTest)

has this output:

my time and time zone: Fri 26 Aug 10:12:38 BST 2016
date says: 1472202758
du says: 0 1472206358 timestampTest

the times are different (an independent check of the time shows that date is correct, so du must be wrong).

Note that on the other hand, human-readable time DOES work correctly for du.
input : date -r timestampTest +%c
output: Fri 26 Aug 2016 10:12:38 BST
input : du --time --time-style=+%c timestampTest
output: 0 Fri 26 Aug 2016 10:12:38 BST timestampTest
These are the same, as expected.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: coreutils 8.25-2ubuntu2
ProcVersionSignature: Ubuntu 4.4.0-34.53-generic 4.4.15
Uname: Linux 4.4.0-34-generic i686
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: i386
CurrentDesktop: KDE
Date: Fri Aug 26 10:29:55 2016
InstallationDate: Installed on 2012-09-28 (1427 days ago)
InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release i386 (20120817.3)
SourcePackage: coreutils
UpgradeStatus: Upgraded to xenial on 2016-08-19 (6 days ago)

Revision history for this message
Alun Perkins (alunalun) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.