Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: BGB Newsgroups: comp.arch Subject: Re: Privilege Levels Below User Date: Mon, 10 Jun 2024 11:38:50 -0500 Organization: A noiseless patient Spider Lines: 44 Message-ID: References: <5h%8O.4327$wDZ.776@fx48.iad> <2024Jun10.090410@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 10 Jun 2024 18:40:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="669cd30644677940012aa21dcb7c2b9c"; logging-data="577507"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ofxr4lNhLXyrYfz16IK4IgckksTwPSfQ=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:vpuT6Mn+o1lyRZYO5xSuvFTD6RM= Content-Language: en-US In-Reply-To: <2024Jun10.090410@mips.complang.tuwien.ac.at> Bytes: 2526 On 6/10/2024 2:04 AM, Anton Ertl wrote: > Terje Mathisen writes: >> Modern Unix typically provides 64-bit time_t seconds and a (effectively) = >> >> 30-bit ns field, so you can store them in a 96-bit container but I don't = >> >> think anyone does that? > > man time_t tells me: > > |time_t > | ... > | Used for time in seconds. According to POSIX, it shall be an > | integer type. > > |timespec > | ... > | struct timespec { > | time_t tv_sec; /* Seconds */ > | long tv_nsec; /* Nanoseconds */ > | }; > | > | Describes times in seconds and nanoseconds. > | > | Conforming to: C11 and later; POSIX.1-2001 and later. > > So if you have a 64-bit time_t, the C standard does that, and POSIX > does it earlier. Typical ABIs pad struct timespec to 128 bits, > though. > Can note, that I was mostly doing 64-bit time in microseconds for internal use. This doesn't change the interface for gettimeofday or clock_gettime(). But, I guess, if nanoseconds is relevant, a nanosecond timer could be provided; but would not be terribly useful on a CPU with a 20ns clock cycle (will be stale well before one can do anything with it). > - anton