NO

Author Topic: localtime an gmtime probs  (Read 3257 times)

gromit

  • Guest
localtime an gmtime probs
« 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

Kaljj

  • Guest
Re: localtime an gmtime probs
« Reply #1 on: March 16, 2010, 12:07:12 pm »
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

I hope its helpful

Bye
Kaljj

gromit

  • Guest
Re: localtime an gmtime probs
« Reply #2 on: March 22, 2010, 12:33:32 am »
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

Kaljj

  • Guest
Re: localtime an gmtime probs
« Reply #3 on: April 07, 2010, 08:27:20 pm »
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