Hi.

The defination of DataType is not just a subset of DateTimeType.  My guess is
the year overflows and corrupts the other data.

Max

typedef struct{ 
  UInt16 year   :7; 
  UInt16 month  :4; 
  UInt16 day    :5; 
} DateType; 
  
typedef DateType *DatePtr; 

typedef struct{ 
  Int16    second; 
  Int16    minute; 
  Int16    hour; 
  Int16    day; 
  Int16    month; 
  Int16    year; 
  Int16    weekDay; 
} DateTimeType 
typedef DateTimeType    *DateTimePtr; 


--- "Todd C. Johnson" <[EMAIL PROTECTED]> wrote:
> I am trying to create a new record with default date and start time. I am
> using the structure and code below. Now.day, now.year, now.month are
> correct. But when move them to the record structure I get different values.
> Now.day should equal record.date.day, but they are not.
> 
> What I am overlooking?
> 
> Thanks,
> 
> Todd
> 
> Here is my record format
> 
>     // Format for record
>     typedef struct
>     {
>       DateType  date;   // Date of service perid
>       DateTimeType start;   // Start of service period
>       DateTimeType end;   // End of service period
>       TimeType  totalTime;  // Time
>     } ServDBRecord;
> 
> Here is the code in question:
>      UInt16   index;
>      ServDBRecord record;
>      DateTimeType now;
> 
>      // Get current date for new Service Period
>      TimSecondsToDateTime(TimGetSeconds(), &now);
> 
>      record.date.day = now.day;                        //now.day=11,
> record.date.day = 20
>      record.date.month = now.month;                 //now.month=12,
> record.date.month = 7
>      record.date.year = now.year;                        //now.month=2001,
> record.date.year = 11
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe, please
> see http://www.palmos.com/dev/tech/support/forums/


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
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