home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,407 of 2,978   
   Dr J R Stockton to All   
   Re: Need a Pascal equivalent to C's diff   
   02 Mar 07 22:00:13   
   
   From: reply0709@merlyn.demon.co.uk   
      
   In comp.lang.pascal.borland message , Fri, 2 Mar   
   2007 00:54:51, Stephen  posted:   
   >I'm using the GetDate and GetTime procedures from the DOS unit to   
   >obtain the date and time. What I am trying to figure out is how to   
   >write a function that will work exactly like C's standard library   
   >function 'difftime()', which returns the difference in *seconds*   
   >between time1 and time2.   
      
   GetDate and GetTime take no cognisance of Time Zone or Summer Time.  I   
   suspect that C difftime may do so, in which case to get an exact   
   equivalent you will need to code and maintain appropriate Sunner Time   
   rules.   
      
   Converting between H M S and seconds-of-day is trivial.   
   Converting between Y M D (Gregorian) and daycount is less easy.   
   Your best move is to convert to seconds-after-epoch, if a longint of   
   seconds will hold enough (68 years or thereabouts)   
      
   Since this is essentially a counting question, there should be no need   
   to use floating-point, with its potential for error.   
      
   Code pieces for BP7 and Delphi are on dateprox.pas, tested by   
   mjd_date.pas, need version.pas, in mjd_date.exe, in mjd_date.zip, via   
   sig line 3 below.   
      
   --   
    (c) John Stockton, Surrey, UK.   ?@merlyn.demon.co.uk   DOS 3.3, 6.20; WinXP.   
    Web   - FAQqish topics, acronyms & links.   
    PAS EXE TXT ZIP via     
    My DOS   - also batprogs.htm.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca