Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #7347

Re: most portable way to compare file times

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: most portable way to compare file times
Date 2011-11-18 20:10 +0100
Organization 1&1 Internet AG
Message-ID <ja6ak2$iqq$1@online.de> (permalink)
References <041be770-8990-49a9-ba0d-6d5397b6bd8a@j10g2000vbe.googlegroups.com> <bee639d3-e9d6-42ae-ae72-cc17c68a852e@cu3g2000vbb.googlegroups.com> <e049fd77-3b60-4f0a-b7ed-366df3b797b1@l24g2000yqm.googlegroups.com> <53e468dd-ed4e-4b1b-9e1a-738a065df9a5@p16g2000yqd.googlegroups.com>

Show all headers | View raw


Alex McDonald wrote:
> Did you mean to add a smiley? I can't tell whether that's weapon's
> grade sarcasm or wide-eyed innocent agreement...

As easy to parse time format, I'd rather suggest seconds or microseconds 
since 1970 (1970 is the time base of the Unix time stamp, so this is 
referring to POSIX) - microseconds that's what Gforth's utime gives you.  
For a file time stamp, seconds are probably good enough, for other 
purposes, you want microseconds.

This is much easier to parse (it's just a 32 or 64 bit number), it's 
easy to calculate differences, and to convert it into a time&date string 
is also not too difficult.  I've put some code here, this is correct 
until around 30 BC, when the Julian calendar was in place, and the 
obvious bugs were fixed (by that time, they had already shifted the year 
by 3 days, so 24th of december was no longer winter solstice).

http://www.forth-ev.de/wiki/doku.php/examples:daymonthyear

I do not want a human readable time format in a Forth program as 
primitive data type.  If you want it human readable, implement something 
like >utime and .utime (>utime would leave it in the picture number 
buffer).

The proposed word would be file-utime ( addr u -- udc uda udu ), with 
three result values, because you might want create, access and 
modification time.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 00:43 -0800
  Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 02:33 -0800
    Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 05:26 -0800
      Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 09:14 -0800
        Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-18 20:10 +0100
          Re: most portable way to compare file times Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-11-18 15:10 -0600
            Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 13:32 -0800
              Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-21 10:22 +0000
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-21 08:51 -0800
            Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-19 00:57 +0100
        Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 14:45 -0800
  Re: most portable way to compare file times "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2011-11-18 05:44 -0500
    Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 05:31 -0800
      Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-18 16:22 +0000
        Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-19 13:59 -0800
          Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 02:06 -0800
            Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 02:44 -0800
              Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-20 14:58 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 06:48 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 08:05 -0800
                Re: most portable way to compare file times Coos Haak <chforth@hccnet.nl> - 2011-11-20 20:53 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 12:21 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-21 21:03 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-21 17:32 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-21 17:45 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-24 15:48 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-24 09:34 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-24 11:58 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-24 17:25 -0800
                Re: most portable way to compare file times "Elizabeth D. Rather" <erather@forth.com> - 2011-11-24 20:56 -1000
                Re: most portable way to compare file times Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-11-25 04:15 -0600
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:17 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 05:47 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 08:58 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 11:43 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-25 11:12 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 05:39 -0800
                Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-27 14:34 +0000
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-27 08:46 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:32 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:51 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-25 16:46 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-25 08:33 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-26 01:11 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-26 12:18 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-26 21:44 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-26 13:18 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 12:45 -0800
            Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 07:49 -0800
        Re: most portable way to compare file times mhx@iae.nl (Marcel Hendrix) - 2011-11-20 09:45 +0200
      Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-18 10:42 -0800
  Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 13:05 -0800

csiph-web