mirror of
https://github.com/devkitPro/wut.git
synced 2026-12-05 16:00:57 -06:00
samples: Never miss a second again!
This commit is contained in:
@@ -11,17 +11,22 @@
|
||||
int
|
||||
hello_thread()
|
||||
{
|
||||
int last_tm_sec = -1;
|
||||
WHBLogPrintf("Hello World from a std::thread!");
|
||||
|
||||
while(WHBProcIsRunning()) {
|
||||
OSCalendarTime tm;
|
||||
OSTicksToCalendarTime(OSGetTime(), &tm);
|
||||
WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.",
|
||||
tm.tm_mday, tm.tm_mon, tm.tm_year,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
if (tm.tm_sec != last_tm_sec) {
|
||||
WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.",
|
||||
tm.tm_mday, tm.tm_mon, tm.tm_year,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
last_tm_sec = tm.tm_sec;
|
||||
}
|
||||
|
||||
WHBLogConsoleDraw();
|
||||
OSSleepTicks(OSMillisecondsToTicks(1000));
|
||||
OSSleepTicks(OSMillisecondsToTicks(100));
|
||||
}
|
||||
|
||||
WHBLogPrintf("Exiting... good bye.");
|
||||
|
||||
Reference in New Issue
Block a user