The datetype struct is in reality one UInt32  in the format
yy(1111111)mm(1111)dd(11111)
therefore you are required to perform a shift operation  on your different
parts of the date


For my example   the year is  UInt32 0000 0000 0111 1111 (max 7 bits)
you will do a shift left (<<) 9 operation to get 1111 1110 0000 0000
   the month is  UInt32 0000 0000 0000 1111 (max 4 bits)
you will do a shift left (<<) 5 operation to get 0000 0001 1110 0000
 so they will be in the correct place
you will not have to change the day since it is already at the correct
place.

then you will put them all into the same UInt32  by performing a bitwise AND
or a
bitwise OR (I apologize I forgot which one) . The result will be a datatype
struct on your
palm app.

I'm sure that someone else probably has a better solution, but since you
seem desparate I gave you my confusing solution. I hope it helps.


Dani


----- Original Message -----
From: "Vini P" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, October 29, 2001 1:51 AM
Subject: Date, date , date and date problem


> Hi,
>    Could any body tell me abt how to solve the date
> problem, Bcoz I am asking this 3 rd time. Does we have
> to do any kind of operations b4 assignig to datetype
> struct. I am uing struct like
> struct DateType
> {
>    WORD day : 4;
>    WORD month : 5;
>    Word year : 7;
> };
>
> Then I am taking out day , month and year from the
> string. and assigning to DateType struct. Does we have
> to add 1904 in date if yes still I am getting problem.
> I am not able to sync from pc to palm.
> my code is like this..
>
> WORD day = 12;
> WORD month = 12;
> WORD year = 2001;
>
> DateType date;
> date.dat = SyncHHToHostWord(day);
> date.month = SyncHHToHostWord (month);
> date.year = SyncHHToHostWord (year);
>
> I know some where I am wrong but where ?????
>
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
>
> --
> 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