[2/3] system_data_types.7: Add 'clock_t'

Message ID 20201017213758.9270-2-colomar.6.4.3@gmail.com
State Not applicable
Headers
Series [1/3] system_data_types.7: time_t: Add Versions note |

Commit Message

Alejandro Colomar Oct. 17, 2020, 9:37 p.m. UTC
  Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
---

Hi Michael,

Does that dash (in "real-floating") need to be escaped?

In my terminal I see it correctly,
but I've seen you escaping some of them and don't know the reason why.

Should they be escaped always, or is it only sometimes, and when?

Thanks,

Alex


 man7/system_data_types.7 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Comments

Michael Kerrisk \(man-pages\) Oct. 18, 2020, 5:56 a.m. UTC | #1
Hi Alex,

On 10/17/20 11:37 PM, Alejandro Colomar wrote:
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
> ---
> 
> Hi Michael,
> 
> Does that dash (in "real-floating") need to be escaped?

No.

> In my terminal I see it correctly,
> but I've seen you escaping some of them and don't know the reason why.

See man-pages(7):

   Real minus character
       Where a real minus character is required (e.g., for  numbers  such
       as  -1,  for  man  page cross references such as utf-8(7), or when
       writing options that have a leading dash, such as in  ls -l),  use
       the following form in the man page source:

           \-

       This guideline applies also to code examples.

The point is that a real-minux sign is needed to that code snippets
can be cut and pasted.

> Should they be escaped always, or is it only sometimes, and when?

In normal text, no escape is needed.

>  man7/system_data_types.7 | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)


> diff --git a/man7/system_data_types.7 b/man7/system_data_types.7
> index dc5f65c0d..6a1442ccd 100644
> --- a/man7/system_data_types.7
> +++ b/man7/system_data_types.7
> @@ -85,6 +85,28 @@ See also:
>  .BR aio_write (3),
>  .BR lio_listio (3)
>  .RE
> +.\"------------------------------------- clock_t ----------------------/
> +.TP
> +.I clock_t
> +.RS
> +Include:
> +.I <time.h>
> +or
> +.IR <sys/types.h> .
> +Alternatively,
> +.IR <sys/time.h> .
> +.PP
> +Used for system time in clock ticks.

Please make it:
"Used for system time either in clock ticks or CLOCKS_PER_SEC"

This type has a strange history. In my book, I note:

    Although the clock_t return type of clock() is the same
    data type that is used in the times() call, the units of
    measurement employed by these two interfaces are
    different. This is the result of historically conflicting
    definitions of clock_t in POSIX.1 and the C programming
    language standard.

> +According to POSIX,
> +it shall be an integer type or a real-floating type.
> +.PP
> +Conforming to:
> +C99 and later; POSIX.1-2001 and later.
> +.PP
> +See also:
> +.BR times (2),
> +.BR clock (3)
> +.RE
>  .\"------------------------------------- div_t ------------------------/
>  .TP
>  .I div_t

Cheers,

Michael
  
Alejandro Colomar Oct. 18, 2020, 9:10 a.m. UTC | #2
Hi Michael,

On 2020-10-18 07:56, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
> On 10/17/20 11:37 PM, Alejandro Colomar wrote:
>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
>> ---
>>
>> Hi Michael,
>>
>> Does that dash (in "real-floating") need to be escaped?
> 
> No.
> 
>> In my terminal I see it correctly,
>> but I've seen you escaping some of them and don't know the reason why.
> 
> See man-pages(7):
> 
>     Real minus character
>         Where a real minus character is required (e.g., for  numbers  such
>         as  -1,  for  man  page cross references such as utf-8(7), or when
>         writing options that have a leading dash, such as in  ls -l),  use
>         the following form in the man page source:
> 
>             \-
> 
>         This guideline applies also to code examples.
> 
> The point is that a real-minux sign is needed to that code snippets
> can be cut and pasted.
> 
>> Should they be escaped always, or is it only sometimes, and when?
> 
> In normal text, no escape is needed.


Thanks.

> 
>>   man7/system_data_types.7 | 22 ++++++++++++++++++++++
>>   1 file changed, 22 insertions(+)
> 
> 
>> diff --git a/man7/system_data_types.7 b/man7/system_data_types.7
>> index dc5f65c0d..6a1442ccd 100644
>> --- a/man7/system_data_types.7
>> +++ b/man7/system_data_types.7
>> @@ -85,6 +85,28 @@ See also:
>>   .BR aio_write (3),
>>   .BR lio_listio (3)
>>   .RE
>> +.\"------------------------------------- clock_t ----------------------/
>> +.TP
>> +.I clock_t
>> +.RS
>> +Include:
>> +.I <time.h>
>> +or
>> +.IR <sys/types.h> .
>> +Alternatively,
>> +.IR <sys/time.h> .
>> +.PP
>> +Used for system time in clock ticks.
> 
> Please make it:
> "Used for system time either in clock ticks or CLOCKS_PER_SEC"
> 
> This type has a strange history. In my book, I note:
> 
>      Although the clock_t return type of clock() is the same
>      data type that is used in the times() call, the units of
>      measurement employed by these two interfaces are
>      different. This is the result of historically conflicting
>      definitions of clock_t in POSIX.1 and the C programming
>      language standard.


Ahhh now I get it.  So CLOCKS_PER_SEC doesn't mean CLOCK_TICKS_PER_SEC, 
right?  I always thought that it really was that, and clock() simply 
returned clock ticks.  But it looks like it returns an arbitrary 
division of the second called CLOCKS_PER_SEC.

I'll add " or CLOCKS_PER_SEC"

> 
>> +According to POSIX,
>> +it shall be an integer type or a real-floating type.
>> +.PP
>> +Conforming to:
>> +C99 and later; POSIX.1-2001 and later.
>> +.PP
>> +See also:
>> +.BR times (2),
>> +.BR clock (3)
>> +.RE
>>   .\"------------------------------------- div_t ------------------------/
>>   .TP
>>   .I div_t
> 
> Cheers,
> 
> Michael
> 
> 
> 

Thanks,

Alex
  
Michael Kerrisk \(man-pages\) Oct. 18, 2020, 1:09 p.m. UTC | #3
Hello Alex,

>> This type has a strange history. In my book, I note:
>>
>>      Although the clock_t return type of clock() is the same
>>      data type that is used in the times() call, the units of
>>      measurement employed by these two interfaces are
>>      different. This is the result of historically conflicting
>>      definitions of clock_t in POSIX.1 and the C programming
>>      language standard.
> 
> 
> Ahhh now I get it.  So CLOCKS_PER_SEC doesn't mean CLOCK_TICKS_PER_SEC, 
> right?  I always thought that it really was that, and clock() simply 
> returned clock ticks.  But it looks like it returns an arbitrary 
> division of the second called CLOCKS_PER_SEC.

More or less. But the standard also says (in the <time.h> spec):

   The value of CLOCKS_PER_SEC shall be 1 million on 
   XSI-conformant systems.

(Yes, it is odd.)

Thanks,

Michael
  
Alejandro Colomar Oct. 19, 2020, 5:40 p.m. UTC | #4
On 2020-10-18 07:56, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
> On 10/17/20 11:37 PM, Alejandro Colomar wrote:
>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
>> ---
>>
>> Hi Michael,
>>
>> Does that dash (in "real-floating") need to be escaped?
> 
> No.
> 
>> In my terminal I see it correctly,
>> but I've seen you escaping some of them and don't know the reason why.
> 
> See man-pages(7):
> 
>     Real minus character
>         Where a real minus character is required (e.g., for  numbers  such
>         as  -1,  for  man  page cross references such as utf-8(7), or when
>         writing options that have a leading dash, such as in  ls -l),  use
>         the following form in the man page source:
> 
>             \-
> 
>         This guideline applies also to code examples.
> 
> The point is that a real-minux sign is needed to that code snippets
> can be cut and pasted.
> 
>> Should they be escaped always, or is it only sometimes, and when?
> 
> In normal text, no escape is needed.


Hi Michael,

Then, in the following code (taken from printf.3)
the escape is wrong (unneeded) by those guidelines?:

[[
.SH NAME
printf, fprintf, dprintf, sprintf, snprintf, vprintf, vfprintf, vdprintf,
vsprintf, vsnprintf \- formatted output conversion
]]

Thanks,

Alex
  

Patch

diff --git a/man7/system_data_types.7 b/man7/system_data_types.7
index dc5f65c0d..6a1442ccd 100644
--- a/man7/system_data_types.7
+++ b/man7/system_data_types.7
@@ -85,6 +85,28 @@  See also:
 .BR aio_write (3),
 .BR lio_listio (3)
 .RE
+.\"------------------------------------- clock_t ----------------------/
+.TP
+.I clock_t
+.RS
+Include:
+.I <time.h>
+or
+.IR <sys/types.h> .
+Alternatively,
+.IR <sys/time.h> .
+.PP
+Used for system time in clock ticks.
+According to POSIX,
+it shall be an integer type or a real-floating type.
+.PP
+Conforming to:
+C99 and later; POSIX.1-2001 and later.
+.PP
+See also:
+.BR times (2),
+.BR clock (3)
+.RE
 .\"------------------------------------- div_t ------------------------/
 .TP
 .I div_t