Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: time functions weirdness |
| Date | Sat, 17 Sep 2016 16:54:55 -0700 |
| Organization | None to speak of |
| Lines | 33 |
| Message-ID | <ln37kyytdc.fsf@kst-u.example.com> (permalink) |
| References | <e45d70Fk5lU1@mid.individual.net> <47758107-38f4-9571-76db-1e5991639649@verizon.net> <e45n6uF2va9U1@mid.individual.net> <723258e8-5b49-0399-f34f-c4303ab43584@verizon.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="15983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FAqtQEwlvC4bh2iWUuJxM" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:5+ngBfgsYo+6Zld50UAeDT4DTgM= sha1:FK/8etiWTQjjhA0LE12BL+j5klA= |
| Xref | csiph.com comp.lang.c:93698 |
Show key headers only | View raw
"James R. Kuyper" <jameskuyper@verizon.net> writes:
[...]
> Here's 100% of what the C standard guarantees about time_t: it is a
> "type capable of representing times" (7.27.1p3). In particular, it does
> not say anything about HOW it represents time. In particular, it does
> not guarantee that it is even an arithmetic type, in which case
> subtraction would not even be permitted. It doesn't say anything about
> the result from a subtraction of two time_t values would be.
C11 requires time_t to be a real type, meaning it's either an
integer type or a non-complex floating-point type.
C90 and C99 both required it to be an arithmetic type. (As far as
I know no C99 implementation took advantage of the permission to
make it a complex type.)
Everything else you said is correct; subtraction is defined, but
it needn't be meaningful. For example, an implementation could
plausibly use an integer type with bit sequences used to represent
year, month, day, etc., or it could represent the current time
(Sat 2016-09-17 21:37:28 UTC) as the integer value 20160917213728.
[...]
[Speaking of times, the clock on the system I'm posting this from is
currently about two hours fast, which affects the timestamps of my
articles. I'm doing what I can about it, which is close to nothing.]
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 17:35 +0000
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 17:38 +0000
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 14:26 -0400
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 20:26 +0000
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 17:21 -0400
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 16:54 -0700
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 18:00 -0400
Re: time functions weirdness Ian Collins <ian-news@hotmail.com> - 2016-09-18 10:45 +1200
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 17:24 -0700
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-18 06:25 +0000
Re: time functions weirdness Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-18 20:40 +0100
Re: time functions weirdness supercat@casperkitty.com - 2016-09-18 16:00 -0700
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 17:04 -0700
csiph-web