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 / January 2004



Tip: Looking for answers? Try searching our database.

Invalid time after waking up

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jorge - 14 Jan 2004 00:20 GMT
Hello everybody,

I'm creating a daemon application using the Carbon framework which is
monitoring application usage. This application writes basically a log
file with the app name and launch time.

It's working fine except one detail: when the Mac is inactive some
minutes, it goes to sleep. When then user activates it again (the Mac
wakes up), and I get the system time (with the GetDateTime function),
this time is invalid, it is not updated. Forcing a delay of 10 seconds
(Delay function) I am able to get the correct date. Is this delay
enough? Is there another solution?.

Thanks in advance.
Robert
Sean McBride - 14 Jan 2004 01:16 GMT
> It's working fine except one detail: when the Mac is inactive some
> minutes, it goes to sleep. When then user activates it again (the Mac
> wakes up), and I get the system time (with the GetDateTime function),
> this time is invalid, it is not updated. Forcing a delay of 10 seconds
> (Delay function) I am able to get the correct date. Is this delay
> enough? Is there another solution?.

Sounds like a bug... perhaps try a different API to get the time?
Michael Ash - 14 Jan 2004 10:23 GMT
> Hello everybody,
>
[quoted text clipped - 8 lines]
> (Delay function) I am able to get the correct date. Is this delay
> enough? Is there another solution?.

This is a system-wide phenomenon. Turn on your menu bar clock if you
haven't, and have a look at it next time you wake your machine from
sleep. It will display the incorrect time for about ten seconds, just as
you've observed in your program.

Waiting is the only workaround that I know of. However, ten seconds is
pretty arbitrary. If I were you, I would check the time every one second
or so and wait for it to make a large jump; at that point you know that
it's updated.
Jorge - 14 Jan 2004 16:55 GMT
That's a good idea, thank you!

> > Hello everybody,
> >
[quoted text clipped - 18 lines]
> or so and wait for it to make a large jump; at that point you know that
> it's updated.
 
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



©2009 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.