home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / MyExpiry.p < prev    next >
Encoding:
Text File  |  1997-04-10  |  1013 b   |  39 lines  |  [TEXT/CWIE]

  1. unit MyExpiry;
  2.  
  3. interface
  4.  
  5.     uses
  6.         Types;
  7.  
  8.     function ExpiredVersion (cs:UInt32; notify, expire: integer): boolean;
  9. { Pass it compdate, and the number of months until it notifies/expires }
  10.  
  11. implementation
  12.  
  13.     uses
  14.         OSUtils, MyStrings, MyEmergencyNotifier, MyUtils, MyTypes, MySystemGlobals;
  15.  
  16.     function ExpiredVersion (cs:UInt32; notify, expire: integer): boolean;
  17.         var
  18.             date: UInt32;
  19.             diff: longint;
  20.     begin
  21.         ExpiredVersion := false;
  22.         if version.numericVersion.stage <> $80 then begin
  23.             GetDateTime(date);
  24.             if compsecs > cs then begin
  25.                 cs := compsecs;
  26.             end;
  27.             diff := date - cs;
  28.             if diff >= expire * (31*day_in_seconds) then begin
  29.                 EmergencyNotify('This developmental version has expired.  Set your clock back, or get a new version');
  30.                 ExpiredVersion := true;
  31.             end else if diff >= notify * (31*day_in_seconds) then begin
  32.                 EmergencyNotify('This developmental version has expired.  It will work for a while, and then stop working forever.  Get a new version');
  33.             end;
  34.         end;
  35.     end;
  36.  
  37.  
  38. end.
  39.