Skip to contentSkip to conversation

New: difftime(3) may suggest that time_t can be a non-arithmetic type

Bug 46731 bugzilla-daemon-590EEB7GvNiWaY/[email protected] 1 participant 2 messages Aug 30, 2012 – Dec 21, 2012 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=46731

Summary: difftime(3) may suggest that time_t can be a
non-arithmetic type
Product: Documentation
Version: unspecified
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: man-pages
AssignedTo: documentation_man-pages-ztI5WcYan/[email protected]
ReportedBy: [email protected]
Regression: No

Created an attachment (id=78851)
--> (https://bugzilla.kernel.org/attachment.cgi?id=78851)
Patch changing the wording to the more exact problem

The difftime(3) manpage[1] states:

NOTES
On a POSIX system, time_t is an arithmetic type, and one could just
define

#define difftime(t1,t0) (double)(t1 - t0)

when the possible overflow in the subtraction is not a concern. On
other
systems, the data type time_t might use some other encoding where subtraction doesn't work directly.

---

When I first read this, I got confused that time_t may actually be a non-arithmetic type. But the C99 standard explicitly lists (in 7.23.1):

3 The types declared are size_t (described in 7.17); clock_t and time_t which
are arithmetic types capable of representing times

---

I think that particular paragraphs should be re-worked to explicitly state what differences can arise in time_t implementations and what is the reason that they can't be used to compute time differences. As far as I understand, the only issue is that time_t can express time in units other than seconds.

I'm attaching a patch with my wording for that.

[1]:http://man7.org/linux/man-pages/man3/difftime.3.html

Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

[Bug 46731] difftime(3) may suggest that time_t can be a non-arithmetic type

In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=46731

Michael Kerrisk <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
         AssignedTo|documentation_man-pages@ker |[email protected]
                   |nel-bugs.osdl.org           |
Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html