How to write current time in printf
on Minix 3.2.1?
I try to use gmtime
like below but it gives error on time(&nowtime)
.
#include <sys/time.h>
#include <time.h>
struct tm *now;
time_t nowtime;
time(&nowtime);
now=gmtime(&nowtime);
printf("TIME is NOW %s",now);
Moreover, I try to recall that in kernel (/usr/src/kernel/main.c) because I need that time on the booting of minix to say when the kernel process is finished and switch to user.
I take some errors on above code like when rebuild the kernel like below;
Not that familiar with minix, but it is similar to Unix & Linux, so maybe something from that platform may be present on minix... so A couple of approaches
Run a man on
ctime
the man page on Linux's
time()
command contains this example code (which you may have to modify for minix, but it shows how to useasctime()
localtime()
andtime()
):