| From: Peter Karlsson <[EMAIL PROTECTED]> | On Sat, 22 Jan 2005, D. Hugh Redelmeier wrote: | | > So: I suspect that a number of the "then" variables should be declared | > "unsigned long", not "u32" and not "u64". Besides being correct, this | > is also portable. Since I've only read the diff, I cannot be sure of | > the uses of "this".
I meant "then", not "this". | Afaicu, u34 and u64 are typedef's specific to the linux kernel, | *guaranteed* to be unsigned integers either 32 bits long or 64 bits | respectively. This is because of unsigned ints can be of different lengths | depending on cpu architechture. That is correct. | Jiffies, from my limited understanding, | has to do with timing, i.e. a jiffie (jiffy?) is usually measured in ms. Measured in HZ, which is 1000 on many architectures. Other common values are 100 and 1024. Note: this need not be the same as the userland HZ. But what type should be used to hold jiffy counts? Traditionally, LINUX has used unsigned long: 32 bits on 32-bit machines. This has the problem that 2 ^ 32 / 1024 seconds is only about 48 days. Long enough for device timeouts but not for uptime or even process times. Since the kernel deals mostly with device timeouts and the like, most uses of the jiffy count can be satisfied with a counter that wraps around after 48 days. But it is important that code can deal with wraparound. For example there are special macros for comparing times in this form (time_after, time_before, ...). To reiterate what I said in my original message: the portable way to declare a variable to hold jiffies is "unsigned long". This works in all architectures... for a slightly broken meaning of "works". In particular, the macros I mentioned will malfunction for durations longer than 24 days (half of the aforementioned 48 days). I imagine that all uses in ivtv would fit within the 24-day limitation. But I have not read the code. ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ ivtv-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ivtv-devel
