Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / July 2003



Tip: Looking for answers? Try searching our database.

Setting the clock

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave J. Catling - 30 Jul 2003 22:32 GMT
Hi all.

I'm trying to set the system clock under OS X but can't see a way to do it.

Found the Carbon functions SetDateTime and friends and some others from the
man pages (settimeofday) although it appears that only root or superusers
can change the time.

What I'm aiming to do is use a handheld GPS device to synchronise the system
clock with UTC time so that a Mac Laptop can be used for recording data in
the field.  I can manage this under OS9 with the Carbon routines just not
OSX (where it is wanted).

Any suggestions?

Thanks
Dave
Matthew Russotto - 31 Jul 2003 16:30 GMT
>Hi all.
>
[quoted text clipped - 8 lines]
>the field.  I can manage this under OS9 with the Carbon routines just not
>OSX (where it is wanted).

First, note that a handheld GPS is not usually a really good time source.  I
don't think you can even guarantee being within a second with the NEMA
output.

That said, yes, you have to be root to set the time.  So make yourself
root and do it.

You can also hook the GPS up as a 'reference clock' to ntpd, though I
haven't tried this with the OS X ntp setup.
Signature

Matthew T. Russotto                            mrussotto@speakeasy.net
"Extremism in defense of liberty is no vice, and moderation in pursuit
of justice is no virtue."  But extreme restriction of liberty in pursuit of
a modicum of security is a very expensive vice.

Dave J. Catling - 31 Jul 2003 18:31 GMT
Inline:

> First, note that a handheld GPS is not usually a really good time source.  I
> don't think you can even guarantee being within a second with the NEMA
> output.

Yeah, I know that, but it's being compared with other handheld GPS units so
hopefully between them all they should be moreorless in sync with each
other, and given the position accuracy I don't think a few tenths of a
second difference in time is going to affect things very much.

The current method is to try to set the time manually using a non-connected
time source (e.g. the talking clock)!  NTP servers are out (no internet
service in the middle of a field).

I know there are probably far better methods available that give greater
accuracy  but these all cost money.

> That said, yes, you have to be root to set the time.  So make yourself
> root and do it.

Yup, got that far today - continually learning about the Mac OS, just when I
thought I had OS9 understood ...  Should be possibly to write an app that
runs from the terminal once logged in as root to set the system clock.

> You can also hook the GPS up as a 'reference clock' to ntpd, though I
> haven't tried this with the OS X ntp setup.

As I understand it the clock won't correct itself instantly but instead
'drifts' to the correct time.  For this application I need to set the time
that is shown on the GPS.

I just need to sort out the problems with serial communication now and I'm
sorted!

Thanks for the reply
Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.