(SOC - Test) Storage Only Commit

This commit is contained in:
William
2024-05-16 06:53:55 +08:00
parent ce09981e05
commit e73f3af436
12 changed files with 189 additions and 86 deletions

View File

@@ -1,9 +1,16 @@
#ifndef COMPOUND_UTILS_H
# define COMPOUND_UTILS_H
# include <time.h>
# include <string.h>
# include <stdlib.h>
# include <Compound/common.h>
# include <Compound/const.h>
# define DATETIME_FORMAT "%a %d %b %X %Z %Y"
int Utils_CalcDigits(long long n);
int Utils_CalcDateTimeLiteralisationLength(char *buff);
#endif /* COMPOUND_UTILS_H */

View File

@@ -14,3 +14,12 @@ int Utils_CalcDigits(long long n)
return i;
}
int Utils_CalcDateTimeLiteralisationLength(char *buff)
{
const time_t now = time(NULL);
(void)strftime(buff, 28, DATETIME_FORMAT, localtime(&now));
return strlen(buff);
}