Detect Diff Time
°³¿ä ¶
UPTIME°ú System clock°úÀÇ ½Ã°£Â÷ ¶
/* By JaeHyuk Cho <minzkn@infoeq.com> */
int CheckTime(void) { const time_t c_TimeWidth = 2; /* ½Ã°£ ¿ÀÂ÷À² : Àû¾îµµ 1ÃÊ ÀÌ»óÀº µÇ¾î¾ß µÇ°ÚÁÒ..? */ static time_t s_DiffTime = (time_t)(0); time_t s_SystemTime, s_CurrentDiffTime; time((time_t *)(&s_SystemTime)); if(sysinfo(&s_SystemInfo) == 0) { if(s_DiffTime == (time_t)(0)) { s_DiffTime = s_SystemTime - s_SystemInfo.uptime; return(0); /* ù¹ø° load */ } } s_CurrentDiffTime = s_SystemTime - s_SystemInfo.uptime; if( (s_CurrentDiffTime - c_TimeWidth) < s_DiffTime && (s_CurrentDiffTime + c_TimeWidth) > s_DiffTime)return(0); /* º¯°æ ¾ÈµÇ¾úÀ½ */ return(1); /* º¯°æµÇ¾úÀ½ */ }
|
Recent investments will yield a slight profit. |