Page MenuHomeFreeBSD

date: add -z output_zone option
ClosedPublic

Authored by bapt on May 19 2023, 9:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 20, 10:02 AM
Unknown Object (File)
Fri, Oct 18, 11:01 AM
Unknown Object (File)
Wed, Oct 16, 8:42 PM
Unknown Object (File)
Tue, Oct 15, 5:33 PM
Unknown Object (File)
Tue, Oct 15, 7:31 AM
Unknown Object (File)
Mon, Oct 14, 3:45 PM
Unknown Object (File)
Mon, Oct 14, 1:17 AM
Unknown Object (File)
Sun, Oct 13, 10:41 PM
Subscribers

Details

Summary

Inpired by OpenBSD date(1), this option allows to do timezone conversion
via the date(1) command.

For example, to determine when the BSDCan livestream begins for me:

$ env -i TZ=EST5EDT date -z Europe/Paris -j 0900

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.May 19 2023, 9:10 AM
kib added inline comments.
bin/date/date.c
196
if (outzone != NULL && setenv("TZ", outzone, 1) != 0)
    err(1, "setenv(TZ)");
bcr added a subscriber: bcr.

OK for the man page part.

This revision is now accepted and ready to land.May 19 2023, 1:20 PM
This revision now requires review to proceed.May 19 2023, 2:59 PM
bapt marked an inline comment as done.May 19 2023, 2:59 PM

I think that the man page ought to include the example from the commit message as well, since an idea to use both -z and TZ is not obvious.

This revision is now accepted and ready to land.May 19 2023, 7:01 PM

Add an example in the manpage of the usage of -z option

This revision now requires review to proceed.May 19 2023, 7:08 PM
This revision was not accepted when it landed; it landed in state Needs Review.May 19 2023, 7:10 PM
This revision was automatically updated to reflect the committed changes.