Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #7471
| From | Bernd Paysan <bernd.paysan@gmx.de> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: most portable way to compare file times |
| Date | 2011-11-25 16:46 +0100 |
| Organization | 1&1 Internet AG |
| Message-ID | <jaod9f$vu5$1@online.de> (permalink) |
| References | (11 earlier) <f23a7f40-ca69-4a72-9193-39fdf53b4b60@d17g2000yql.googlegroups.com> <jallg5$joe$1@online.de> <82474078-1b33-4baa-b569-251bd88610b5@y12g2000vba.googlegroups.com> <ee795d27-33a9-45e7-81cb-5e6d45c5f944@n14g2000vbn.googlegroups.com> <9cc1991c-fd64-4bb7-b508-f8eed5e0e1e2@cc2g2000vbb.googlegroups.com> |
BruceMcF wrote: > On Nov 24, 2:58 pm, Alex McDonald <b...@rivadpm.com> wrote: >> Which is why I suggested a string up-thread; cell size doesn't >> matter, and resolution can be whatever you wish. > > Its my preferred option, as I think of time stamping and timers as two > different things, but if they're chasing up a ticks-since-epoch style > semantic for porting among POSIX systems, I'd be happy if it was not > unnecessarily impossible to implement by smaller systems. I'm ok with the double ticks + single resolution (in ticks/s) solution. That one is dead easy to implement on a small system (you usually have some timer running where you can derive that value), and it is easy to process. Note that on a small system, the "epoch" starts when you booted the device, since you often don't have a real time clock. What I want to have: * I don't want to impose the presence of a RTC, since it is not always possible * I don't want to deal with strings, since this means some sort of primitive memory management (the make example will read the time stamps of a number of files, and then determine what to do, so a simple "is valid until the next call of this word" is not acceptable), and, on a small system, is a costly operator * I want it be a primitive data type, so that you can use readily available operators * I don't want to arbitrary limit the precision So on a 64 bit system, femtoseconds since big bang is possible, on a 32 bit system, microseconds since 1970.1.1T0:0:0Z won't wrap around soon, and on a 16 bit system, you might have 10 millisecond ticks since the last boot, which wraps around after one and a half year. This is not the format you want your medical records in, but you won't create those on such a small system. Networked systems always should synchronize their clocks with each other or with a common, high-quality clock source. A network stack with time stamps can drop packets with "impossible" time stamps (an acknowledge for a packet timed before the package was sent, or after the acknowledge was received is impossible). If the system has a real time clock and/or is synchronized to a global clock, then it should provide the information when the epoch started. Also, the ticks themselves should never go back. I.e. if your clock needs to be synchronized by -1.2 seconds after boot, you correct the epoch starting point, not the actual tick counter. If you figure out durning synchronization, that your so-called "nanoseconds" really are 1002039185 ticks per second, just report that, and adjust the start of the epoch accordingly. I'd propose the nominal clock starting point to be 1970.1.1T0:0:0Z. This would be three words for the timing: ticks ( -- d ) ticks since the epoch, monotonuous function, serializes the instruction stream, i.e. for any ticks ... ticks -, this is guaranteed to be <=0. ticks/s ( -- u ) ticks per second epoch ( -- d ) epoch started d ticks after 1970.1.1T00:00:00Z (negative means "before"), this is an optional word. And for files, you have file-ticks ( -- dc dw da ). A standard program should assume that the timer may roll over. How do we deal with small systems that have an RTC, but don't have enough bits to represent the epoch return value? -- Bernd Paysan "If you want it done right, you have to do it yourself" http://bernd-paysan.de/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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