2009-01-19 22:05:27 +00:00
|
|
|
/*
|
2009-08-06 11:01:44 +00:00
|
|
|
* COPYRIGHT: LGPL, See LGPL.txt in the top level directory
|
2009-01-19 22:05:27 +00:00
|
|
|
* PROJECT: ReactOS CRT library
|
|
|
|
* FILE: lib/sdk/crt/time/ftime.c
|
|
|
|
* PURPOSE: Deprecated BSD library call
|
|
|
|
* PROGRAMERS: Timo Kreuzer
|
|
|
|
*/
|
|
|
|
#include <precomp.h>
|
|
|
|
#include <sec_api/time_s.h>
|
|
|
|
#include <sys/timeb.h>
|
|
|
|
#include "bitsfixup.h"
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* \name _ftime_s
|
|
|
|
* \brief Get the current time.
|
|
|
|
* \param [out] ptimeb Pointer to a structure of type struct _timeb that
|
|
|
|
* recieves the current time.
|
|
|
|
* \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx
|
|
|
|
*/
|
|
|
|
errno_t
|
|
|
|
_ftime_s(struct _timeb *ptimeb)
|
|
|
|
{
|
|
|
|
DWORD ret;
|
|
|
|
TIME_ZONE_INFORMATION TimeZoneInformation;
|
|
|
|
FILETIME SystemTime;
|
|
|
|
|
|
|
|
/* Validate parameters */
|
|
|
|
if (!ptimeb)
|
|
|
|
{
|
2009-08-06 00:26:23 +00:00
|
|
|
#if 0
|
2009-01-19 22:05:27 +00:00
|
|
|
_invalid_parameter(0,
|
|
|
|
0,//__FUNCTION__,
|
|
|
|
_CRT_WIDE(__FILE__),
|
|
|
|
__LINE__,
|
|
|
|
0);
|
2009-08-06 00:26:23 +00:00
|
|
|
#endif
|
2009-01-19 22:05:27 +00:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GetTimeZoneInformation(&TimeZoneInformation);
|
|
|
|
ptimeb->dstflag = (ret == TIME_ZONE_ID_DAYLIGHT) ? 1 : 0;
|
|
|
|
ptimeb->timezone = TimeZoneInformation.Bias;
|
|
|
|
|
|
|
|
GetSystemTimeAsFileTime(&SystemTime);
|
|
|
|
ptimeb->time = FileTimeToUnixTime(&SystemTime, &ptimeb->millitm);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* \name _ftime
|
|
|
|
* \brief Get the current time.
|
|
|
|
* \param [out] ptimeb Pointer to a structure of type struct _timeb that
|
|
|
|
* recieves the current time.
|
|
|
|
* \note This function is for compatability and simply calls the secure
|
|
|
|
* version _ftime_s().
|
|
|
|
* \sa http://msdn.microsoft.com/en-us/library/z54t9z5f.aspx
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_ftime(struct _timeb *ptimeb)
|
|
|
|
{
|
|
|
|
_ftime_s(ptimeb);
|
|
|
|
}
|