apio
7fb2807d0c
All checks were successful
continuous-integration/drone/push Build is passing
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.
28 lines
472 B
C
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");
|
|
}
|