• Unix time

    From Sean Dennis@1:18/200 to Bjorn Felten on Mon Dec 5 22:15:12 2005

    I'm trying to use your Unix2Norm routine in your UnixTime unit (found it in the
    sensationcontent.com archives), but I'm not sure on how to actually use it. I've never dealt with the DAYTIME format before. I'm trying to convert the unixtime format from a file that my BBS creates to a normal time format for the
    CGI I'm writing (you can see the cgi working at http://outpostbbs.darktech.org/cgi-bin/recent.cgi).

    Any help is appreciated.


    // sean@outpostbbs.net | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - outpostbbs.darktech.org (1:18/200)
  • From Björn Felten@2:203/2 to Sean Dennis on Tue Dec 6 06:25:13 2005
    I've never dealt with the DAYTIME format before.

    I guess you mean DateTime? If so, it's a very useful record, that you really
    should get used to. You can find out all about it, in the IDE, by pressing Ctrl-F1 with the cursor located on the word. Basically it's a record defined, in the DOS unit, as:

    DateTime = record
    Year,Month,Day,Hour,Min,Sec: Word;

    Here's a little test program for you, just to get you started. Add the variable DT to your Watch window in the IDE and then trace through the program with F8 to the line with Unix2Norm, press F7 to get into the UnixUtil unit, and
    then more F8 to see how DT changes in the Unix2Norm procedure.

    uses UnixUtil, Dos;

    var DT: DateTime;
    unixtime: longint;

    function z2p(W: word): string;
    z2p:=chr(W div 10 + 48) + chr(W mod 10 + 48)

    Unix2Norm(unixtime, DT);
    with DT do begin
    write('Unixtime will only be valid until');
    write(' ',Year,'-',z2p(Month),'-',z2p(Day));
    write(' ',z2p(Hour),':',z2p(Min),':',z2p(Sec));

    * Origin: news://felten.yi.org (2:203/2)