VoiceIt Technologies, LLC

Web Based Support
It is currently Fri Sep 10, 2010 6:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: date manipulation in PocketStudio 2.1
PostPosted: Wed Jun 22, 2005 1:06 pm 
I'm building a simulation application using PocketStudio 2.1 and am having trouble dealing with dates. Part of my problem is understanding the types associated with dates (i.e. differences between datetype and datetimetype). In Delphi, the TDateTime type is a double. If you try to do math (i.e. the interval between two datetimetypes) in PocketStudio, you get an error. For example, trunc(date2 - date1) in Delphi will give you the number of days between date1 and date2. Doesn't work in PocketStudio. I'm also interested in the difference between the datetype and datetimetype as I'm running up against memory limits. I assume the datetype is a datetimetype with the decimal (time) portion truncated. Any help would be appreciated.

Mark Kinsel


Top
  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 6:21 am 
Mark,

They are both pascal records defined in \Lib\PalmOS\DateTime.pas
Code:
  DateTimeType = record
    second: Int16;
    minute: Int16;
    hour: Int16;
    day: Int16;
    month: Int16;
    year: Int16;
    weekDay: Int16; // Days since Sunday (0 to 6)
    end;

DateType is a record containing only a 16 bit value
Code:
  DateType = record
    Bits: UInt16;
    end;

The bits are used as follows (left hand is most significant bit)

1111111000000000 7 bits year
0000000111100000 4 bits month
0000000000011111 5 bits day

In \PSL\PSUtils.pas you will find the functions
Code:
function Year(Date: DateType): UInt16;
function Month(Date: DateType): UInt8;
function Day(Date: DateType): UInt8;

to extract the components.

Hope that helps.


Top
  
 
 Post subject: Thanks for the help
PostPosted: Thu Jun 23, 2005 11:18 am 
Thanks for the help. That was what I needed and I'm making progress now.

Mark


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group