📄 pc_udate.c
字号:
/************************************************************************
*
* Copyright (c) 2001 by Accelerated Technology, Inc.
*
* PROPRIETARY RIGHTS of Accelerated Technology are involved in
* the subject matter of this material. All manufacturing,
* reproduction, use, and sales rights pertaining to this subject
* matter are governed by the license agreement. The recipient of
* this software implicitly accepts the terms of the license.
*
*
**************************************************************************
* FILE NAME VERSION
*
* PC_UPDATE.C FILE/MCF5206/Diab/2.2.1
*
* COMPONENT
*
* Nucleus File
*
* DESCRIPTION
*
* When the system needs to date stamp a file it will call this
* routine to get the current time and date. YOU must modify the
* shipped routine to support your hardware's time and date
* routines. If you don't modify this routine the file date on all
* files will be the same.
*
* The source for this routine is in file pc_udate.c and is self
* explanatory.
*
* DATA STRUCTURES
*
* None.
*
* FUNCTIONS
*
* pc_getsysdate Get date and time from the
* host system.
*
* DEPENDENCIES
*
* pcdisk.h File common definitions
*
* NOTE: This module is linked in with File.lib. After you make *
* changes, you must rebuild File.lib. *
*******************************************************************/
#include "pcdisk.h"
#include "..\io\time.h"
/************************************************************************
* FUNCTION
*
* pc_getsysdate
*
* DESCRIPTION
*
* Get date and time from the host system.
*
*
* INPUTS
*
* pd Date stamping buffer.
*
* OUTPUTS
*
* Pointer of the buffer of date structure.
*
*************************************************************************/
//below is added by Liao Yibai on 2002.7.9
//extern UTINY *g_Hour, *g_Minute, *g_Sec;
//extern UTINY *g_Year, *g_Month, *g_Day;
extern struct time Time;
DATESTR *pc_getsysdate(DATESTR *pd)
{
UINT16 year; /* relative to 1980 */
UINT16 month; /* 1 - 12 */
UINT16 day; /* 1 - 31 */
UINT16 hour;
UINT16 minute;
UINT16 sec; /* Note: seconds are 2 second/per. ie 3 == 6 seconds */
UINT8 cenmsec;
//below is added by taohuibin
hour = Time.Hour;
minute = Time.Minute;
sec = Time.Second;
cenmsec = 0 ;
year = Time.Year; //2000 - 1980 relative to 1980
month = Time.Month; // 1 - 12
day = Time.Day;
//end of adding
pd->cmsec = cenmsec;
pd->time = (UINT16) ( (hour << 11) | (minute << 5) | sec );
pd->date = (UINT16) ( (year << 9) | (month << 5) | day );
return(pd);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -