projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auto-Merge pull request #2519 from octo/ff/strerror
[collectd.git]
/
src
/
daemon
/
utils_time.c
diff --git
a/src/daemon/utils_time.c
b/src/daemon/utils_time.c
index
815d969
..
a807c7f
100644
(file)
--- a/
src/daemon/utils_time.c
+++ b/
src/daemon/utils_time.c
@@
-47,9
+47,7
@@
cdtime_t cdtime(void) /* {{{ */
status = clock_gettime(CLOCK_REALTIME, &ts);
if (status != 0) {
status = clock_gettime(CLOCK_REALTIME, &ts);
if (status != 0) {
- char errbuf[1024];
- ERROR("cdtime: clock_gettime failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("cdtime: clock_gettime failed: %s", STRERRNO);
return 0;
}
return 0;
}
@@
-64,9
+62,7
@@
cdtime_t cdtime(void) /* {{{ */
status = gettimeofday(&tv, /* struct timezone = */ NULL);
if (status != 0) {
status = gettimeofday(&tv, /* struct timezone = */ NULL);
if (status != 0) {
- char errbuf[1024];
- ERROR("cdtime: gettimeofday failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("cdtime: gettimeofday failed: %s", STRERRNO);
return 0;
}
return 0;
}
@@
-85,10
+81,8
@@
static int get_utc_time(cdtime_t t, struct tm *t_tm, long *nsec) /* {{{ */
NORMALIZE_TIMESPEC(t_spec);
if (gmtime_r(&t_spec.tv_sec, t_tm) == NULL) {
NORMALIZE_TIMESPEC(t_spec);
if (gmtime_r(&t_spec.tv_sec, t_tm) == NULL) {
- char errbuf[1024];
int status = errno;
int status = errno;
- ERROR("get_utc_time: gmtime_r failed: %s",
- sstrerror(status, errbuf, sizeof(errbuf)));
+ ERROR("get_utc_time: gmtime_r failed: %s", STRERRNO);
return status;
}
return status;
}
@@
-102,10
+96,8
@@
static int get_local_time(cdtime_t t, struct tm *t_tm, long *nsec) /* {{{ */
NORMALIZE_TIMESPEC(t_spec);
if (localtime_r(&t_spec.tv_sec, t_tm) == NULL) {
NORMALIZE_TIMESPEC(t_spec);
if (localtime_r(&t_spec.tv_sec, t_tm) == NULL) {
- char errbuf[1024];
int status = errno;
int status = errno;
- ERROR("get_local_time: localtime_r failed: %s",
- sstrerror(status, errbuf, sizeof(errbuf)));
+ ERROR("get_local_time: localtime_r failed: %s", STRERRNO);
return status;
}
return status;
}
@@
-164,7
+156,7
@@
int format_rfc3339(char *buffer, size_t buffer_size, struct tm const *t_tm,
size_left -= len;
if (print_nano) {
size_left -= len;
if (print_nano) {
- if ((len = s
s
nprintf(pos, size_left, ".%09ld", nsec)) == 0)
+ if ((len = snprintf(pos, size_left, ".%09ld", nsec)) == 0)
return ENOMEM;
pos += len;
size_left -= len;
return ENOMEM;
pos += len;
size_left -= len;