https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191512
Bug ID: 191512
Summary: /bin/date -j -v-sun returns a Saturday instead of
Sunday
Product: Base System
Version: 9.3-RELEASE
Hardware: i386
OS: Any
Status: Needs Triage
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: chocolate.camera at gmail.com
## Summary
For some specific dates (and maybe time zones) using `date` to get the time and
date of the previous Sunday returns a Saturday instead.
## Steps to reproduce
I tried this on Mac OS X 10.9.3, as I do not have a FreeBSD system. I am sure
all steps can be reproduced with FreeBSD, I just cannot instruct you how.
1. In System Preferences > Date & Time, deactivate the setting to set time
and date automatically from a remote server.
2. Set you timezone to US/Pacific (Los Angeles, CA; I have not tried with
other timezones) and your date and time to **Friday, 2014 March 14, 23:30**.
3. In Terminal, run:
date -j -v-sun
and take note of the output.
4. Set your time to 1 hour later, i.e. **Saturday, 2014 March 15, 00:30**,
and run the same command again, taking note of the output.
5. Again, set again your date and time to 1 hour later, i.e. **Saturday,
2014 March 15, 01:30**, and run the same command again, taking note of the
output.
## Expected result
The date returned should be the same on 3, 4 & 5, only the hour changing (it
being the same as the one you set it to, within seconds). I.e.:
3: Sun Mar 9 23:30:00 PST 2014
4: Sun Mar 9 00:30:00 PST 2014
5: Sun Mar 9 01:30:00 PST 2014
## Actual results
Only for the moment in the middle, **Saturday, 2014 March 15, from 00:00:00 to
00:59:59**, the command returns the previous Saturday instead of the previous
Sunday:
3: Sun Mar 9 00:30:00 PST 2014
4: Sat Mar 8 23:30:00 PST 2014
5: Sun Mar 9 00:30:00 PST 2014
#Note
Probably it has to do with the change to/from Daylight Saving Time, which for
US/Pacific is **Sunday, March 9, 02:00** and **Sunday, November 2, 2:00**.
The command is not requesting the date of today minus 1 week, though, but the
date of the previous Sunday, so it should return a Sunday irrespective of any
change from/to Daylight Saving Time.
Don’t trust the "Version" field in this bug report as I do not know what
FreeBSD’s version of `date` Mac OS X 10.9.3 uses.
--
You are receiving this mail because:
You are the assignee for the bug.