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,408 of 2,978   
   Heinrich Wolf to All   
   Re: Need a Pascal equivalent to C's diff   
   03 Mar 07 07:03:29   
   
   From: invalid@invalid.invalid   
      
   "Dr J R Stockton"  schrieb im Newsbeitrag   
   news:qTaXG1ot5J6FFwKw@invalid.uk.co.demon.merlyn.invalid...   
   > 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.   
      
   You are right in some point!   
   This function, I posted is too simple.   
      
   Function JulianischeZeit(Z : GenaueZeit) : JulianTime;   
     begin   
       With Z, Z.GrobeZeit do   
         JulianischeZeit :=   
           JulianischerTag(Year, Month,   
                           Day + ((((S100 / 100) + Sec) / 60   
                                   + Min) / 60   
                                  + Hour) / 24);   
     end;   
      
   It is valid only for Hour, Min and Sec as GMT.   
   You cannot simply insert GetTime here,   
   but must shift that by time zone and daylight saving offset.   
      
   C mktime() does that.   
   But for C difftime() that does not make a difference.   
   When time1 is wrong by the timezone and time2 is wrong by the same amount,   
   then the difference results to 0.   
      
   Regards   
   Heiner   
      
   --- 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