summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 580d183)
raw | patch | inline | side by side (parent: 580d183)
author | Florian Forster <ff@octo.it> | |
Fri, 18 Jun 2010 19:03:52 +0000 (21:03 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 18 Jun 2010 19:03:52 +0000 (21:03 +0200) |
src/utils_params.c | patch | blob | history | |
src/utils_params.h | patch | blob | history |
diff --git a/src/utils_params.c b/src/utils_params.c
index 2c7bcc2e6fc409a007c04162162ed0fef587a0b5..bfde56b6200cbe24011df99a05f089129f4c8304 100644 (file)
--- a/src/utils_params.c
+++ b/src/utils_params.c
return (ret);
} /* }}} char *script_name */
+int time_to_rfc1123 (time_t t, char *buffer, size_t buffer_size) /* {{{ */
+{
+ struct tm tm_tmp;
+ size_t status;
+
+ if (localtime_r (&t, &tm_tmp) == NULL)
+ return (errno);
+
+ status = strftime (buffer, buffer_size, "%a, %d %b %Y %T %z", &tm_tmp);
+ if (status == 0)
+ return (errno);
+
+ return (0);
+} /* }}} int time_to_rfc1123 */
+
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/utils_params.h b/src/utils_params.h
index 5d0c845fe135fd3b39b09e70a88897a114a9d6af..0d3f0e56abca99533261b70c9ad40f9f43573917 100644 (file)
--- a/src/utils_params.h
+++ b/src/utils_params.h
#ifndef UTILS_PARAMS_H
#define UTILS_PARAMS_H 1
+#include <time.h>
+
int param_init (void);
void param_finish (void);
const char *script_name (void);
+int time_to_rfc1123 (time_t t, char *buffer, size_t buffer_size);
+
#endif /* UTILS_PARAMS_H */