time Utility for working with time/dates

This commit is contained in:
2025-10-16 14:15:55 +02:00
parent 7445689010
commit 553b893a9c
4 changed files with 88 additions and 0 deletions

24
user/time/main.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdint.h>
#include <stddef.h>
#include <ulib.h>
#define CMDS(X) \
X(now)
void main(void) {
if (argslen() == 0) {
return;
}
char *cmd = args()[0];
#define X(name) if (string_strcmp(cmd, #name) == 0) { \
extern void tm_ ## name(void); \
tm_ ## name(); \
return; \
}
CMDS(X)
#undef X
uprintf("time: unknown command %s\n", cmd);
}