2009-03-11 17:45 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbdate.h
  * harbour/source/common/hbgete.c
  * harbour/source/common/hbdate.c
  * harbour/source/rtl/seconds.c
  * harbour/source/rtl/hbffind.c
  * harbour/source/rtl/filesys.c
  * harbour/source/compiler/cmdcheck.c
  * harbour/contrib/hbct/files.c
  * harbour/contrib/xhb/filestat.c
  * harbour/contrib/hbmzip/hbmzip.c
  * harbour/contrib/hbtip/utils.c
  * harbour/contrib/examples/uhttpd/uhttpdc.c
    * cleaned feature test macros usage
This commit is contained in:
Przemyslaw Czerpak
2009-03-11 16:39:32 +00:00
parent f3bf261945
commit d44fea92a9
13 changed files with 91 additions and 107 deletions

View File

@@ -260,40 +260,31 @@ int hb_dateDOW( int iYear, int iMonth, int iDay )
void hb_dateToday( int * piYear, int * piMonth, int * piDay )
{
#if defined(HB_OS_WIN)
{
SYSTEMTIME st;
SYSTEMTIME st;
GetLocalTime( &st );
*piYear = st.wYear;
*piMonth = st.wMonth;
*piDay = st.wDay;
#elif ( defined( _POSIX_C_SOURCE ) || defined( _XOPEN_SOURCE ) || \
defined( _BSD_SOURCE ) || defined( _SVID_SOURCE ) ) && \
! defined( HB_OS_DARWIN_5 )
time_t t;
struct tm st;
time( &t );
localtime_r( &t, &st );
*piYear = st.tm_year + 1900;
*piMonth = st.tm_mon + 1;
*piDay = st.tm_mday;
GetLocalTime( &st );
*piYear = st.wYear;
*piMonth = st.wMonth;
*piDay = st.wDay;
}
#else
{
time_t t;
struct tm st;
time_t t;
struct tm * oTime;
time( &t );
oTime = localtime( &t );
*piYear = oTime->tm_year + 1900;
*piMonth = oTime->tm_mon + 1;
*piDay = oTime->tm_mday;
time( &t );
# if defined( HB_HAS_LOCALTIME_R )
localtime_r( &t, &st );
# else
st = *localtime( &t );
# endif
*piYear = st.tm_year + 1900;
*piMonth = st.tm_mon + 1;
*piDay = st.tm_mday;
}
#endif
}
@@ -307,26 +298,17 @@ void hb_dateTimeStr( char * pszTime )
GetLocalTime( &st );
hb_snprintf( pszTime, 9, "%02d:%02d:%02d", st.wHour, st.wMinute, st.wSecond );
}
#elif ( defined( _POSIX_C_SOURCE ) || defined( _XOPEN_SOURCE ) || \
defined( _BSD_SOURCE ) || defined( _SVID_SOURCE ) ) && \
! defined( HB_OS_DARWIN_5 )
{
time_t t;
struct tm st;
time( &t );
localtime_r( &t, &st );
hb_snprintf( pszTime, 9, "%02d:%02d:%02d", st.tm_hour, st.tm_min, st.tm_sec );
}
#else
{
time_t t;
struct tm * oTime;
struct tm st;
time( &t );
oTime = localtime( &t );
hb_snprintf( pszTime, 9, "%02d:%02d:%02d", oTime->tm_hour, oTime->tm_min, oTime->tm_sec );
# if defined( HB_HAS_LOCALTIME_R )
localtime_r( &t, &st );
# else
st = *localtime( &t );
# endif
hb_snprintf( pszTime, 9, "%02d:%02d:%02d", st.tm_hour, st.tm_min, st.tm_sec );
}
#endif
}

View File

@@ -158,7 +158,7 @@ BOOL hb_setenv( const char * szName, const char * szValue )
#elif defined( _BSD_SOURCE ) || _POSIX_C_SOURCE >= 200112L || \
_XOPEN_SOURCE >= 600 || defined( __WATCOMC__ ) || defined( __DJGPP__ ) || \
defined( HB_OS_BSD ) || defined( HB_OS_DARWIN )
defined( HB_OS_SUNOS ) || defined( HB_OS_BSD ) || defined( HB_OS_DARWIN )
if( szValue )
return setenv( szName, szValue, 1 ) == 0;