Pelles C forum
C language => Pocket PC and Smartphone questions => Topic started by: gromit on March 14, 2010, 11:13:35 PM
-
Hi all
programming a pda
localtime and gmtime both show error of
Missing prototype for 'localtime'.
#include <time.h>
time_t now;
struct tm *tm_now;
now = time ( NULL );
tm_now = localtime ( &now );
This from my searches appears to be a problem with whereby localtime will not work in my PDA
Am unable to take advantage of %V or %U format strings to return week Number
currently using Windows API
GetLocalTime(&st); // address of system time structure
This does not seem to allow for a format string to return week Number
Looking for another way to fill a _tm struct
Any Advice gratefully recieved
BTIA gromit
-
Hi Gromit,
I don't know wich System you are use.
The Systemtime of windows CE 5.0 is without the week number.
Look on MSDN http://msdn.microsoft.com/en-us/library/aa450923.aspx (http://msdn.microsoft.com/en-us/library/aa450923.aspx)
I hope its helpful
Bye
Kaljj
-
Thanks for the link but so far no joy.
I will keep slogging away at this one
Think i may have to do a
Return week num from yearday using divide by 7
Then calculate if first week is in fact week 53 or not
If i find a definitive way to do this i will post it
In the meantime any further suggestions gratefully recieved
Big Thanks gromit
-
Hi Gromit,
if you like the german way to calc the calenderweek
you must look to the 4 rules
1) First week with 4 Days
2) First week with a thursday
3) The Week include the 4 January
4) First complete Week
I found this KWeek = ((d - t - 3 + (Weekday(t) + 1) Mod 7)) \ 7 + 1
I hope is helpfull.
Bye Kaljj