📄 posix.c
字号:
#include "platform.h"#include "mco.h"static time_t init_time = 0;timer_unit mco_system_get_current_time(){ unsigned long r; struct timeb t; ftime(&t); if ( init_time == 0 ) init_time = t.time; r = (t.time-init_time)*1000; r += t.millitm; return (timer_unit)r;}/* Suspend the current thread for the specified # of milliseconds */void Sleep( unsigned long millisecs) { struct timespec tm1; struct timespec tm2; tm1.tv_sec = millisecs / 1000; tm1.tv_nsec = (millisecs % 1000) * 1000000; while (nanosleep(&tm1, &tm2) != 0) memcpy(&tm1, &tm2, sizeof(struct timespec));}/* print string to STDOUT & flush buffer */void Printf(char *str,...){ va_list argptr; va_start(argptr, str); vfprintf(stdout, str, argptr); va_end(argptr); fflush(stdout);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -