Context: GCC prc-tools, Palm OS Emulator 3.5, SDK 4.0, cygwin.

I am trying to implement a 30-day trial period, and have tried two
different approaches, neither of which works. I have checked the
archives under "TimGetSeconds" and "DateAdjust" but found nothing
appropriate.

what am I doing wrong?


UInt32 timenow = TimGetSeconds(); // I got 3132120149 (2/24/1933
21:54:13) on the last run
DateTimeType *dt_expiry;
DateType *d_expiry;
UInt32 gExpiry;

/* first attempt: bus error (read from non-mapped memory)*/
TimSecondsToDateTime( timenow, dt_expiry );
DateSecondsToDate( timenow, d_expiry );
DateAdjust( d_expiry, 30 );
dt_expiry->year  = d_expiry->year;
dt_expiry->month = d_expiry->month;
dt_expiry->day   = d_expiry->day;
gExpiry = TimDateTimeToSeconds( dt_expiry );

/* 2nd attempt: "warning: integer overflow" */
gExpiry = timenow + 30 * 24 * 60 * 60;  // current time + 30 days * 24
hrs * 60 min. * 60 seconds



and here is the perl script I used to sanity test my 2nd attempt:

#!/usr/bin/perl
$timenow = time;
  ($sec,$min,$hour,$mday,$mon,$year) = localtime( $timenow );
  $year += 1900;
  $mon++;   #$mon has range 0-11 so increase by one
  print "$mon/$mday/$year $hour:$min:$sec\n";

$newtime = $timenow + 30 * 24 * 60 * 60;
  ($sec,$min,$hour,$mday,$mon,$year) = localtime( $newtime );
  $year += 1900;
  $mon++;   #$mon has range 0-11 so increase by one
  print "$mon/$mday/$year $hour:$min:$sec\n";

$emulatortime = 3132120149;
  ($sec,$min,$hour,$mday,$mon,$year) = localtime( $emulatortime );
  $year += 1900;
  $mon++;   #$mon has range 0-11 so increase by one
  print "$mon/$mday/$year $hour:$min:$sec\n";


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

Reply via email to