diff options
author | Mattias Andrée <maandree@kth.se> | 2018-10-31 21:10:30 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-10-31 21:10:30 +0100 |
commit | 2db79cba45042bdacb5f2478bc02c5f80f1bb74f (patch) | |
tree | 6167a6e9a047b9ffe065fd5428b08bd1575eb375 /man | |
parent | Add man page for timespectostr and timevaltostr (diff) | |
download | libsimple-2db79cba45042bdacb5f2478bc02c5f80f1bb74f.tar.gz libsimple-2db79cba45042bdacb5f2478bc02c5f80f1bb74f.tar.bz2 libsimple-2db79cba45042bdacb5f2478bc02c5f80f1bb74f.tar.xz |
More documentation
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man')
-rw-r--r-- | man/libsimple_minimise_number_string.3 | 64 | ||||
-rw-r--r-- | man/libsimple_strtotimespec.3 | 133 | ||||
-rw-r--r-- | man/libsimple_timespectostr.3 | 2 | ||||
l--------- | man/minimise_number_string.3libsimple | 1 | ||||
l--------- | man/strtotimespec.3libsimple | 1 | ||||
l--------- | man/strtotimeval.3libsimple | 1 |
6 files changed, 201 insertions, 1 deletions
diff --git a/man/libsimple_minimise_number_string.3 b/man/libsimple_minimise_number_string.3 new file mode 100644 index 0000000..310b725 --- /dev/null +++ b/man/libsimple_minimise_number_string.3 @@ -0,0 +1,64 @@ +.TH LIBSIMPLE_MINIMISE_NUMBER_STRING 3 2018-10-31 libsimple +.SH NAME +libsimple_minimise_number_string \- ninimise a numerical string +.SH SYNOPSIS +.nf +#include <libsimple.h> + +char *libsimple_minimise_number_string(char *\fIs\fP); + +#ifndef minimise_number_string +# define minimise_number_string libsimple_minimise_number_string +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_minimise_number_string () +function minimises a string representing a real value with +the assumption that the string is on the format +.B [+-]\e?[0-9]*\e(\e.[0-9]*\e)\e? +(repeating decimals are not supported). +.SH RETURN VALUE +The +.BR libsimple_minimise_number_string () +function returns the pointer +.IR s . +.SH ERRORS +The +.BR libsimple_minimise_number_string () +function cannot fail. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_minimise_number_string () +T} Thread safety MT-Safe +T{ +.BR libsimple_minimise_number_string () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_minimise_number_string () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None. +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_timespectostr (3) diff --git a/man/libsimple_strtotimespec.3 b/man/libsimple_strtotimespec.3 new file mode 100644 index 0000000..85ff88b --- /dev/null +++ b/man/libsimple_strtotimespec.3 @@ -0,0 +1,133 @@ +.TH LIBSIMPLE_STRTOTIMESPEC 3 2018-10-31 libsimple +.SH NAME +libsimple_strtotimespec, libsimple_strtotimeval \- convert a string to a duration data structure +.SH SYNOPSIS +.nf +#include <libsimple.h> + +int libsimple_strtotimespec(struct timespec *restrict \fIts\fP, const char *\fIs\fP, char **\fIend\fP); +int libsimple_strtotimeval(struct timeval *restrict \fItv\fP, const char *\fIs\fP, char **\fIend\fP); + +#ifndef strtotimespec +# define strtotimespec libsimple_strtotimespec +#endif +#ifndef strtotimeval +# define strtotimeval libsimple_strtotimeval +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_strtotimespec () +and +.BR libsimple_strtotimeval () +functions will parse the string +.IR s , +representing a real value of number of seconds, +and store the value in +.I ts +and +.R tv +respectively, rounding to the nearest nanosecond +(for the +.BR libsimple_strtotimespec ()) +or microsecond +(for the +.BR libsimple_strtotimeval ()). +These functions will ignore any leading whitespace +and byte where the parsing stopped, as +.I s +with an offset, to +.IR end . +The parsed part of +.I s +must contain atleast one digit and be on the +format +.BR [+-]\e?[0-9]*\e(\e.[0-9]*\e(\e.[0-9]*\e|([0-9]*)\e)\e?\e)\e? . +where the digits in +.BR \e2 , +if any, are repeating decimals and must contain atleast +one digit if it is included. +.SH RETURN VALUE +The +.BR libsimple_strtotimespec () +and +.BR libsimple_strtotimeval () +functions return 0 upon successful completion; +otherwise \-1 is returned. +.SH ERRORS +The +.BR libsimple_strtotimespec () +and +.BR libsimple_strtotimeval () +functions fail if: +.TP +.B EINVAL +.I s +does not represent a real value in a recognised format. +.I *end +will not be set. +.TP +.B ERANGE +The result is too large or too small to be store. Either +.I *ts +will be set to +.I {.tv_sec=TIME_MAX,.tv_nsec=999999999L} +and +.I *tv +set to +.I {.tv_sec=TIME_MAX,.tv_usec=999999L} +(if the result is too large) or to +.I {.tv_sec=TIME_MIN,.tv_nsec=0L} +and +.I {.tv_sec=TIME_MIN,.tv_usec=0L} +(if the result is too small). +.I *end +will be set. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_strtotimespec () +.br +.BR libsimple_strtotimeval () +T} Thread safety MT-Safe +T{ +.BR libsimple_strtotimespec () +.br +.BR libsimple_strtotimeval () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_strtotimespec () +.br +.BR libsimple_strtotimeval () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None. +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_sumtimespec (3), +.BR libsimple_difftimespec (3), +.BR libsimple_multimespec (3), +.BR libsimple_cmptimespec (3), +.BR libsimple_timespectostr (3), +.BR libsimple_timespectodouble (3), +.BR libsimple_doubletotimespec (3), +.BR libsimple_timeval2timespec (3) diff --git a/man/libsimple_timespectostr.3 b/man/libsimple_timespectostr.3 index 1585603..d6e2b71 100644 --- a/man/libsimple_timespectostr.3 +++ b/man/libsimple_timespectostr.3 @@ -96,7 +96,7 @@ failed because it could not allocate enough memory. .I ts->tv_nsec is negative or greater than 999\ 999\ 999, or .I tv->tv_usec -is negative or greater than 999\ 999, or +is negative or greater than 999\ 999. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). diff --git a/man/minimise_number_string.3libsimple b/man/minimise_number_string.3libsimple new file mode 120000 index 0000000..7d0d47c --- /dev/null +++ b/man/minimise_number_string.3libsimple @@ -0,0 +1 @@ +libsimple_minimise_number_string.3
\ No newline at end of file diff --git a/man/strtotimespec.3libsimple b/man/strtotimespec.3libsimple new file mode 120000 index 0000000..9bc7f8b --- /dev/null +++ b/man/strtotimespec.3libsimple @@ -0,0 +1 @@ +libsimple_strtotimespec.3
\ No newline at end of file diff --git a/man/strtotimeval.3libsimple b/man/strtotimeval.3libsimple new file mode 120000 index 0000000..21cc596 --- /dev/null +++ b/man/strtotimeval.3libsimple @@ -0,0 +1 @@ +libsimple_strtotimeval.3
\ No newline at end of file |