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 1,910 of 2,978   
   Dr John Stockton to All   
   Re: Help convert C function to Pascal fu   
   25 Sep 05 18:32:09   
   
   From: jrs@merlyn.demon.co.uk   
      
   JRS:  In article <3pkj4mFanvkgU1@individual.net>, dated Sat, 24 Sep 2005   
   09:04:22, seen in news:comp.lang.pascal.borland, Robert AH Prins   
    posted :   
   >> As I am not familiar with the C programming language, I would   
   >> greatly appreciate it if someone could please convert the C   
   >> function below to a Pascal function. Thanks!   
   >>   
   >>   
   >> /* converts time into units of milliseconds */   
   >> long mytime(void)   
   >> {   
   >>   static struct time t;   
   >>   static struct date d;   
   >>   static long mama;   
   >>   
   >>   getdate(&d);   
   >>   gettime(&t);   
   >>   
   >>   mama = ((((dostounix(&d,&t)-unixstart)*100)+t.ti_hund)*10);   
   >>   
   >>   return(mama);   
   >> }   
   >It takes the current timestamp (yyyy-mm-dd-hh.mm.ss.uu) and converts it   
   >to milliseconds since, IIRC, 1970. I'm sure you can do that yourself.   
      
   But since when in 1970?  The beginning, I expect you mean.  But which   
   beginning?  1970-01-01 began in New Zealand long before it began in   
   Hawaii.  The UNIX standard is 1970.0 GMT (which was at 01:00 hours   
   here).   
      
   If C getdate and gettime get local date and time, maybe dostounix allows   
   for that.   
      
   ISTM that the OP should first ask in a C group to get the code   
   translated into English, and then translate that into Pascal.   
      
   It's quite likely that the milliseconds are used exclusively for   
   differencing with other similar milliseconds, in which case the base of   
   the count does not matter.  However, if the OP is in a country which has   
   Summer Time (he gives no indication, so is assumed American), he should   
   be aware that days can have 23,24,25 hours.   
      
   I don't know what a C long is; but a Pascal longint will only store a   
   little under 25 days-worth of milliseconds - it may be necessary to use   
   a comp variable (unless the OP is a Delphi user who has not yet   
   understood the wisdom of posting Delphi questions to Delphi newsgroups).   
      
   --   
    © John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v4.00   MIME. ©   
    Web   - w. FAQish topics, links, acronyms   
    PAS EXE etc :  - see 00index.htm   
    Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.   
      
   --- 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