📄 gettod.c
字号:
/* $id:dmGettod.c V1.0 2001/09/5 */
/******************************************************************************
* This source code has been made available to you by CORETEK on
* AS-IS.Anyone receiving this source is licensed under
* CORETEK copyrights to use it in any way he or she deems fit,including
* copying it,modifying it,compiling it,and redistributing it either with
* or without modifictions.
*
*
* Any person who transfers this source code or any derivative work must
* include the CORETEK copyright notice, this paragraph,and the preceding
* two paragraphs in the transferred software.
*
*
* COPYRIGHT CORETEK CORPORATION 2001
* LICENSED MATERIAL - PROGRAM PROPERTY OF CORETEK
*****************************************************************************/
/******************************************************************************
*
* FILE: Gettod.c
*
* MODULE: RLT
*
* PURPOSE: gettimeofday() - SVR4 and BSD4.3 extension required by Newlib.
*
* AUTHOR(S):Zhang Yumin
*
* GROUP:TOOL_GROUP
*
* DATE CREATED:2001/09/05
*
* REFERENCE DOCUMENT ID:
*
* MODIFICATIONS:
* Date user Name Description
* 2001/09/05 Zhang Yumin Create this file
*
*********************************************************************************/
#include <sys/time.h>
#include <sys/reent.h>
extern int sys_gettimeofday(struct timeval *tp, struct timezone *tzp);
/*
* NOTE: The solaris gettimeofday does not have a second parameter.
*/
/********************************************************************
* FUNCTION: gettimeofday
*
* PURPOSE: return the precise time from 00:00:00
* January 1, DM_TOD_BASE_YEAR until the current time of day.
* PARAMETERS:
*
* Input: tp -A point to a struct which contain the time informations.
* tzp -Not implemented.
* Output: None
* InOut: None
*
* Return value: Upon successful completion, a value of 0 is returned.
* Otherwise, a value of -1 is returned and the global
* integer variable errno is set to indicate the error.
* Reentrant: Yes
********************************************************************/
int _gettimeofday_r(
struct _reent *ptr,
struct timeval *tp,
struct timezone *tzp
)
{
int rc = sys_gettimeofday(tp,tzp);
if(rc < 0)
{
ptr->_errno = -rc;
return -1;
}
return rc;
}
#ifndef _REENT_ONLY
int gettimeofday(
struct timeval *tp,
struct timezone *tzp
)
{
return _gettimeofday_r(_REENT,tp,tzp);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -