如何在Minix 3.2.1上寫printf
的當前時間?
我嘗試使用如下所示的gmtime
,但它在time(&nowtime)
上給出錯誤。Minix當前時間
#include <sys/time.h>
#include <time.h>
struct tm *now;
time_t nowtime;
time(&nowtime);
now=gmtime(&nowtime);
printf("TIME is NOW %s",now);
而且,我回想一下,在內核(/usr/src/kernel/main.c),因爲我需要時間MINIX的啓動說,當內核進程結束,並切換到用戶。
我在上面的代碼中發現了一些錯誤,比如像下面這樣重建內核的時候;
1)代碼不包括''? 2)發佈錯誤消息。 –
chux
是的time.h包含 結構tm *現在給錯誤重新定義'現在'與一個不同的類型。我現在也改變了nowwwww,但仍然給出了相同的錯誤 – Palindrom
似乎有一個矛盾:「給現在的時間錯誤(&nowtime)'」和「struct tm * now」給錯誤重新定義'now'「。可疑錯誤不在'時間(&nowtime)'上。 – chux