diff options
Diffstat (limited to 'lib/roken/parse_time.3')
| -rw-r--r-- | lib/roken/parse_time.3 | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/lib/roken/parse_time.3 b/lib/roken/parse_time.3 index f7a801b51f69d..da326cb3bc219 100644 --- a/lib/roken/parse_time.3 +++ b/lib/roken/parse_time.3 @@ -1,34 +1,34 @@ -.\" Copyright (c) 2004 Kungliga Tekniska Högskolan -.\" (Royal Institute of Technology, Stockholm, Sweden). -.\" All rights reserved. +.\" Copyright (c) 2004 Kungliga Tekniska Högskolan +.\" (Royal Institute of Technology, Stockholm, Sweden). +.\" All rights reserved. .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: .\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. .\" -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. .\" -.\" 3. Neither the name of the Institute nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. +.\" 3. Neither the name of the Institute nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" $Id: parse_time.3 14325 2004-10-30 22:34:28Z lha $ +.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" $Id$ .\" .Dd October 31, 2004 .Dt PARSE_TIME 3 @@ -52,13 +52,13 @@ The roken library (libroken, -lroken) .Ft size_t .Fn unparse_time_approx "int seconds" "char *buf" "size_t len" .Sh DESCRIPTION -The +The .Fn parse_time function converts a the period of time specified in into a number of seconds. -The +The .Fa timespec -can be any number of +can be any number of .Aq number unit pairs separated by comma and whitespace. The number can be negative. Number without explicit units are taken as being @@ -68,12 +68,12 @@ The .Fn unparse_time and .Fn unparse_time_approx -does the opposite of +does the opposite of .Fn parse_time , that is they take a number of seconds and express that as human -readable string. +readable string. .Fa unparse_time -produces an exact time, while +produces an exact time, while .Fa unparse_time_approx restricts the result to only include one units. .Pp @@ -99,13 +99,13 @@ Units names can be arbitrarily abbreviated (as long as they are unique). .Sh RETURN VALUES .Fn parse_time -returns the number of seconds that represents the expression in +returns the number of seconds that represents the expression in .Fa timespec or -1 on error. .Fn unparse_time -and -.Fn unparse_time_approx -return the number of characters written to +and +.Fn unparse_time_approx +return the number of characters written to .Fa buf . if the return value is greater than or equal to the .Fa len @@ -140,7 +140,7 @@ main(int argc, char **argv) } .Ed .Bd -literal -$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s" +$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s" 1 year = 365 days 1 month = 30 days 1 week = 7 days |
