mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 16:29:50 +00:00
b684d1b186
If SS is not given a value, it is assumed to be zero. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
40 lines
751 B
C
40 lines
751 B
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* Utility routines.
|
|
*
|
|
* Copyright (C) 2007 Denys Vlasenko
|
|
*
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
|
*/
|
|
#include "libbb.h"
|
|
|
|
#ifndef __GNO__
|
|
|
|
static char* strftime_fmt(char *buf, unsigned len, time_t *tp, const char *fmt)
|
|
{
|
|
time_t t;
|
|
if (!tp) {
|
|
tp = &t;
|
|
time(tp);
|
|
}
|
|
/* Returns pointer to NUL */
|
|
return buf + strftime(buf, len, fmt, localtime(tp));
|
|
}
|
|
|
|
char* FAST_FUNC strftime_HHMMSS(char *buf, unsigned len, time_t *tp)
|
|
{
|
|
return strftime_fmt(buf, len, tp, "%H:%M:%S");
|
|
}
|
|
|
|
char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp)
|
|
{
|
|
return strftime_fmt(buf, len, tp, "%Y-%m-%d %H:%M:%S");
|
|
}
|
|
|
|
#endif
|
|
|
|
unsigned long FAST_FUNC monotonic_sec(void)
|
|
{
|
|
return time(NULL);
|
|
}
|