Luna/apps/app.c
apio 7fb2807d0c
All checks were successful
continuous-integration/drone/push Build is passing
libc: Implement time() using clock_gettime().
The cool POSIX kids use clock_gettime() now because it has NANOSECONDS (and different clocks!),
but ANSI C prefers this function.

We can still implement it based on clock_gettime(), we just have to discard the NANOSECONDS.
2023-01-07 00:27:23 +01:00

28 lines
472 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void bye()
{
console_print("byeee!\n");
}
int main()
{
atexit(bye);
char buffer[64];
snprintf(buffer, sizeof(buffer), "Welcome to %s!\n", "Luna");
console_print(buffer);
time_t now = time(NULL);
snprintf(buffer, sizeof(buffer), "Realtime clock: %ld s\n", now);
console_print(buffer);
for (int i = 0; i < atoi("8"); i++) { console_print("."); }
console_print("\n");
}