20 lines
407 B
C
20 lines
407 B
C
|
/* see LICENSE file for details on license */
|
||
|
#include <stdio.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
#include "datetime.h"
|
||
|
|
||
|
int datetime_update(struct module *module) {
|
||
|
time_t t = time(NULL);
|
||
|
if(t == -1) return -1;
|
||
|
struct tm *tm = localtime(&t);
|
||
|
if(!tm) return -1;
|
||
|
|
||
|
snprintf((char *)&module->buffer,
|
||
|
MODULE_BUFFER_LEN, "%.02i%.02i-%.02i:%.02i",
|
||
|
tm->tm_mon, tm->tm_mday,
|
||
|
tm->tm_hour, tm->tm_min);
|
||
|
|
||
|
return 0;
|
||
|
}
|