Files
m241Neelima/components/ip_net2-6.9/ipcom/port/src/ipcom_xtime.c
T
2026-07-30 11:19:44 +05:30

147 lines
4.0 KiB
C

/*
******************************************************************************
* SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipcom_xtime.c,v $ $Revision: 1.16 $
* $Source: /home/interpeak/CVSRoot/ipcom/port/src/ipcom_xtime.c,v $
* $Author: jonas $ $Date: 2008-08-20 14:00:41 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Lennart Bang <lob@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipcom_config.h"
#include "ipcom_clib.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#if defined(IPCOM_CLOCK) && defined(IPCOM_TIME)
#define IPCOM_USE_CLIB_PROTO
#else
#include <time.h>
#if !defined(IP_PORT_WIN32) && !defined(IP_PORT_VXWORKS) && !defined(IP_PORT_RTCORE)
#include <sys/time.h>
#endif
#endif
#include "ipcom_clib.h"
#include "ipcom_time.h"
/*
****************************************************************************
* 4 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 5 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 6 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 LOCAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipcom_clock
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
#if defined(IPCOM_CLOCK) && IPCOM_CLOCK == 1
IP_PUBLIC Ip_clock_t
ipcom_clock(void)
{
struct Ip_timeval tv;
ipcom_microtime(&tv);
/* Return microseconds since CLOCKS_PER_SEC = 1000000 in ANSI C/POSIX */
return tv.tv_sec * 1000000 + tv.tv_usec;
}
#endif
/*
*===========================================================================
* ipcom_time
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
#if defined(IPCOM_TIME) && IPCOM_TIME == 1
IP_PUBLIC Ip_time_t
ipcom_time(Ip_time_t *tp)
{
struct Ip_timeval tv;
(void)ipcom_gettimeofday(&tv, IP_NULL);
if (tp != IP_NULL)
*tp = (Ip_time_t)tv.tv_sec;
return (Ip_time_t)tv.tv_sec;
}
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/