Bug 200083 - [PATCH] ntpdate sets the wrong date on big-endian systems
Summary: [PATCH] ntpdate sets the wrong date on big-endian systems
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: mips Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-05-09 20:08 UTC by Anmol Khirbat
Modified: 2015-07-15 16:44 UTC (History)
2 users (show)

See Also:


Attachments
usr.sbin/ntp/config.h patch to define WORDS_BIGENDIAN (327 bytes, patch)
2015-05-09 20:08 UTC, Anmol Khirbat
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anmol Khirbat 2015-05-09 20:08:47 UTC
Created attachment 156581 [details]
usr.sbin/ntp/config.h patch to define WORDS_BIGENDIAN

This was originally reported on the freebsd-mips mailing list, but this is a general problem on any big-endian system
https://lists.freebsd.org/pipermail/freebsd-mips/2015-April/003823.html

The attached patch ensures that usr.sbin/ntp/config.h defines WORDS_BIGENDIAN on the platforms that require it.

Steps to reproduce

- observe current time
root@:~ # date
Sat May  9 18:16:34 UTC 2015

- turn the clock back a few seconds
root@:~ # date 1816 
Sat May  9 18:16:00 UTC 2015
May  9 18:16:00  date: date set by root

- invoke ntpdate
root@:~ # ntpdate -v time.apple.com
 9 May 18:16:08 ntpdate[871]: ntpdate 4.2.8p2-a (1)
 1 Jan 00:00:00 ntpdate[871]: step time server 17.253.22.243 offset 49.928947 sec

- observe the time again (the time is wrong)
root@:~ # date 
Thu Jan  1 00:00:02 UTC 1970 

System information

root@:~ # uname -a
FreeBSD  11.0-CURRENT FreeBSD 11.0-CURRENT #6 904b0d8(master): Sat May  9 07:17:15 UTC 2015     anmol@fbsd:/usr/home/anmol/obj/mips.mips/usr/home/anmol/freebsd/sys/MALTA  mips
Comment 1 Christian Brueffer freebsd_committer freebsd_triage 2015-07-15 16:44:54 UTC
This was fixed in r284864.  Thanks for the report!