Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #157662
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: I need help understand some c code |
| Date | 2020-12-23 12:05 -0800 |
| Organization | None to speak of |
| Message-ID | <87ft3w9tkp.fsf@nosuchdomain.example.com> (permalink) |
| References | (1 earlier) <rrp8ij$r14$1@dont-email.me> <87czz3bw39.fsf@nosuchdomain.example.com> <2a1EH.305965$YVH9.53781@fx06.ams4> <rrr55m$kj0$1@dont-email.me> <vZKEH.27916$Vj2.269@fx16.iad> |
scott@slp53.sl.home (Scott Lurndal) writes:
> T <T@invalid.invalid> writes:
>>On 12/21/20 5:11 AM, Bart wrote:
>>> time_t'
>>
>>What I was after was what type of variable that was. How
>>many bits etc.. But I don't need it anymore as I was
>>mistaken that I was not addressing a .so or .dll.
>>
>>> Also I use WinAPI for the time. Here's an example of calling Windows'
>>> GetSystemTime()
>>
>>Now that I can also use as an example of how to get
>>the time on both Windows and Linux.
>
> Although the time(2) system call has been replaced by
> the gettimeofday(2) system call which offers microsecond
> resolution instead of second resolution.
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html
It hasn't been "replaced". time() is defined by both ISO C and POSIX.
gettimeofday() is defined by POSIX -- and has been marked obsolescent
as of POSIX Issue 7.
C17 adds timespec_get, which gives you the current time with nanosecond
precision (but not necessarily nanosecond accuracy).
> Both system calls have been augmented by the POSIX
> clock functions (clock_getres, clock_gettime, clock_settime)
> which support multiple clock sources and have nanosecond resolution.
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html
>
> The 'type' of time_t (insofar as any portable application is concerned):
>
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
>
> There you'll find these statements about the characteristics of 'time_t':
>
> "All of the types shall be defined as arithmetic types
> of an appropriate length"
>
> "clock_t shall be an integer or real-floating type. time_t shall
> be an integer type."
>
> Many platforms typedef 'time_t' as long.
POSIX places stricter requirements on time_t than ISO C does.
C only requires time_t to be a real (integer or floating) type
"capable of representing times". It doesn't even require that
increasing values represent increasing times.
Most platforms typedef time_t as a signed integer type of 32 or, if
possible, 64 bits, representing seconds since the epoch (1970-01-01
00:00:00 UTC). (Windows has 32-bit long, so I believe it defines
time_t as long long.) A conforming implementation could define time_t
as a floating-point type, but I'm not aware of any that do so.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I need help understand some c code T <T@invalid.invalid> - 2020-12-20 18:32 -0800
Re: I need help understand some c code Siri Cruise <chine.bleu@yahoo.com> - 2020-12-20 19:03 -0800
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 19:56 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 20:02 -0800
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 20:43 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 21:06 -0800
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 21:56 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 20:33 -0800
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 20:51 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 21:11 -0800
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-20 22:10 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-20 22:15 -0800
Re: I need help understand some c code Bart <bc@freeuk.com> - 2020-12-21 13:11 +0000
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-21 13:47 -0800
Re: I need help understand some c code scott@slp53.sl.home (Scott Lurndal) - 2020-12-23 17:18 +0000
Re: I need help understand some c code Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-12-23 12:05 -0800
Re: I need help understand some c code T <T@invalid.invalid> - 2020-12-21 14:25 -0800
Re: I need help understand some c code Bonita Montero <Bonita.Montero@gmail.com> - 2020-12-21 05:45 +0100
Re: I need help understand some c code Bart <bc@freeuk.com> - 2020-12-21 12:16 +0000
Re: I need help understand some c code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-21 20:03 +0000
csiph-web