pg_time.c

来自「一个移植到凌阳单片机spce061a上面的实时操作系统」· C语言 代码 · 共 73 行

C
73
字号
///////////////////////////////////////////////////////////////
//
//
//   PGOS : A Portable,Configable Embedded System Kernel
//
//             
//
//   This is an open source project under GPL lincence  
//
//        Version 0.9.0 ---- Development Snopshot
//
//   File name : pg_time.c : Time functions implemention  
//   History :
//
//          2005-07-24  First build by X.K. @ PGOS Team  
//          
/////////////////////////////////////////////////////////////////

#include "pgos.h"

#if  PG_TIME_SUPPORT  == 1

DWORD  pgos_time_sec ;
DWORD  pgos_time_min ;
DWORD  pgos_time_hour ;
DWORD  pgos_time_day ;


VOID    pgos_tim_clrtime( )
{
     pgos_time_sec = 0 ;
     pgos_time_min = 0 ;
     pgos_time_hour = 0;
     pgos_time_day = 0 ;
}

VOID    pgos_tim_process( )
{
     pgos_time_sec ++ ;
     if(  pgos_time_sec % 60 == 0 )
     {
         pgos_time_min ++ ;
	  if(  pgos_time_min % 60 == 0 )
	  {
	      pgos_time_hour ++ ;
	      if(  pgos_time_hour % 24 == 0 )
	      {
	           pgos_time_day ++ ;	           
	      }
	 }
    }
}


DWORD  pgos_tim_getsec( )
{
     return  pgos_time_sec ;
}

DWORD  pgos_tim_getmin(  )
{
    return pgos_time_min ;
}
DWORD  pgos_tim_gethour( )
{
    return pgos_time_hour ;
}
DWORD  pgos_tim_getday( )
{
    return pgos_time_day ;
}

#endif // TIME_SUPPORT

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?