diff options
author | Bruno Haible <bruno@clisp.org> | 2021-01-02 13:14:08 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-01-02 13:14:08 +0100 |
commit | caf114a384a66c506ad1304197264cfac64f1fbc (patch) | |
tree | 5bfd5ada4d616facfc59cf428bfac4c24423f2ed /lib/timespec_get.c | |
parent | 2d4f9d5c5a0c6dbdc2fbe34c42fe9cd74f162af3 (diff) | |
download | gnulib-caf114a384a66c506ad1304197264cfac64f1fbc.tar.gz |
timespec_get: New module.
* lib/time.in.h (timespec_get): New declaration.
* lib/timespec_get.c: New file.
* m4/timespec_get.m4: New file.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize
GNULIB_TIMESPEC_GET, HAVE_TIMESPEC_GET.
* modules/time (Makefile.am): Substitute GNULIB_TIMESPEC_GET,
HAVE_TIMESPEC_GET.
* modules/timespec_get: New file.
* tests/test-time-c++.cc (timespec_get): Check signature.
* doc/glibc-functions/timespec_get.texi: Mention the new module.
Diffstat (limited to 'lib/timespec_get.c')
-rw-r--r-- | lib/timespec_get.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/timespec_get.c b/lib/timespec_get.c new file mode 100644 index 0000000000..d738c12b89 --- /dev/null +++ b/lib/timespec_get.c @@ -0,0 +1,33 @@ +/* timespec_get() function. + Copyright (C) 2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <time.h> + +#include "timespec.h" + +int +timespec_get (struct timespec *ts, int base) +{ + if (base == TIME_UTC) + { + gettime (ts); + return base; + } + return 0; +} |