Bug 243502 - date '+%s' shows wrong value
Summary: date '+%s' shows wrong value
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-22 09:14 UTC by olaf
Modified: 2020-01-22 11:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description olaf 2020-01-22 09:14:24 UTC
date '+%s' shows wrong value.

Linux: 1579684042
FreeBSD: 135

According to 'man strftime', %s should be 'number of seconds since the Epoch, UTC'

# date '+%s'
513

# date -r 513
Thu Jan  1 01:08:33 CET 1970
Comment 1 Yuri Pankov freebsd_committer freebsd_triage 2020-01-22 10:03:52 UTC
Which date binary is that? What is the date output without modifiers?

$ uname -psr
FreeBSD 12.1-RELEASE-p1 amd64
$ which date
/bin/date
$ date '+%s'
1579687351
Comment 2 Pawel Biernacki freebsd_committer freebsd_triage 2020-01-22 10:11:12 UTC
Can you please share the output of:

sysctl kern.boottime
date; date -r `date '+%s'`

Can't confirm on various installations of 13-C.
Comment 3 olaf 2020-01-22 11:13:22 UTC
I investigated further, and it turned out that a tool from sysutils/munin-contrib was setting the (wrong) date to 1.1.1970 instead of doing a convertion task.