Re: Time Program needed
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Sun, 31 Jul 2005 23:23:15 GMT
komobu wrote:
I need a Palm program to compute GMT time, and return the julian date or "Numeric Day of the Year" for the current GMT time. I would like to be able to enter the hour offset for where ever in the world I happen to be. I would also like to be able to adjust my palm clock from this app. Is it possible to build a program to do this using code warrior?
Sure. Why wouldn't it be possible?
Have you looked at the "Time Manager" chapter in the API reference? It has probably most of what you need.
I don't think there is a function to give you the days since the beginning of the year, but to figure out how many days today is since the beginning of the year, you should be able to use DateToDays() twice to get the answer:
UInt32 now; DateType today; DateType firstdaythisyear; UInt32 dayssincejanuary1st;
now = TimGetSeconds()
DateSecondsToDate(now, &today);
firstdaythisyear.year = now.year; firstdaythisyear.month = 1; firstdaythisyear.day = 1;
dayssincejanuary1st = DateToDays(today) - DateToDays(firstdaythisyear);
This will give 0 for January 1st, so add 1 if you want the first day of the year to be day #1 instead of day #0.
For the GMT stuff, you may be able to use TimTimeZoneToUTC() and TimUTCToTimeZone(), depending on your purposes.
- Logan .
- References:
- Time Program needed
- From: komobu
- Time Program needed
- Prev by Date: Time Program needed
- Next by Date: Re: CodeWarrior for Palm is BACK
- Previous by thread: Time Program needed
- Next by thread: Re: CodeWarrior for Palm is BACK
- Index(es):