The DateType is a bunch of bitfields.
The DateTimeType is a bunch of integers.

It is possible (especially depending on your compilation optimization
options) that the debugger cannot display the DateType fields correctly
so the values may be right in reality, but just display wrong in
the debugger.
Turn off all optimizations and then do this:

int m,d,y;

m = date.month;
d = date.day;
y = date.year + 1904;

Now look at those three variables and see if they are correct.

Brandon

Gee Ng wrote:
> 
> Hello!
> 
> Thanks for all the quick replies! Still having problems...
> 
> > > Can someone help me with these 2 lines of code?? It's driving me nuts!
> > >    DateType   date;
> > >    DateSecondsToDate (TimGetSeconds(), &date);
> > > I personally don't see what's wrong with this code, but it
> > > always returns me the wrong date. What's the catch?
> >
> > Gee, it looks fine to me too.  How are you determining that the date is
> > wrong -- viewing it in a debugger, or displaying the date on the screen,
> or
> > something else?  Just what wrong date does it return?
> 
> I ran the code on POSE 3.0a5 with the OS3.5 release ROM (transferred from a
> Vx, as I don't have access to debug ROMs from the Pavilion), and CW6 has
> been updated with OS3.5 Update 1.
> 
> I further experimented with the following code:
> 
>    DateType   date;
>    DateTimeType dateTime;
>    ULong    seconds;
> 
>    // Determine today's date
>    seconds = TimGetSeconds();
>    DateSecondsToDate (seconds, &date);
>    TimSecondsToDateTime (seconds, &dateTime);
> 
> The following is what I got from the debugger: (Note that I'm staying in
> Singapore and if I'm not mistaken, we are half a day ahead of the States.)
> 
> seconds     3042841471
> dateTime    0x0039C64
>   - second  31
>   - minute  44
>   - hour    1
>   - day     3
>   - month   6
>   - year    2000
>   - weekDay 6
> date        0x0039C74
>   - year    67
>   - month   1
>   - day     24
> 
> Apparantly, dateTime is the right date and time, but date is wrong. What
> gives?!
> 
> Regards,
> Gee.
> 
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to