diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-14 18:40:14 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-14 18:40:14 +0000 |
commit | 3ebfc4037ce47cd6104c50ffad828f273656aa67 (patch) | |
tree | b2b85ce785c295e2bcf7ba63fff0ff8236755472 /ace | |
parent | 3f66c332175de394bed2cbb0ff987c0cdff8cfaa (diff) | |
download | ATCD-3ebfc4037ce47cd6104c50ffad828f273656aa67.tar.gz |
ChangeLogTag: Mon Jul 14 18:31:52 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/OS.cpp | 25 | ||||
-rw-r--r-- | ace/os_include/os_errno.h | 5 |
2 files changed, 19 insertions, 11 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index a430de02b3e..bd6375d8ced 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -4852,9 +4852,12 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) return 1; } #elif defined (VXWORKS) - // inet_aton() returns 0 upon failure, not -1 since -1 is a valid - // address (255.255.255.255). - ACE_OSCALL_RETURN (::inet_aton ((char*)host_name, addr), int, 0); + // inet_aton() returns OK (0) on success and ERROR (-1) on failure. + // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 + ::errnoSet(0); + int result = ERROR; + ACE_OSCALL (::inet_aton ((char*)host_name, addr), int, ERROR, result); + return (result == ERROR) ? 0 : 1; #else // inet_aton() returns 0 upon failure, not -1 since -1 is a valid // address (255.255.255.255). @@ -4891,9 +4894,9 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) // This is really stupid, converting FILETIME to timeval back and // forth. It assumes FILETIME and DWORDLONG are the same structure // internally. - + TIME_ZONE_INFORMATION pTz; - + const unsigned short int __mon_yday[2][13] = { /* Normal years. */ @@ -4901,10 +4904,10 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) /* Leap years. */ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; - + ULARGE_INTEGER _100ns; ::GetTimeZoneInformation (&pTz); - + _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 + ACE_Time_Value::FILETIME_to_timval_skew; FILETIME file_time; file_time.dwLowDateTime = _100ns.LowPart; @@ -4916,16 +4919,16 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) FileTimeToSystemTime (&localtime, &systime); res->tm_hour = systime.wHour; - + if(pTz.DaylightBias!=0) res->tm_isdst = 1; else res->tm_isdst = 1; - + int iLeap; iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0)); // based on leap select which group to use - + res->tm_mday = systime.wDay; res->tm_min = systime.wMinute; res->tm_mon = systime.wMonth; @@ -4934,7 +4937,7 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay; res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900 res->tm_year = res->tm_year - 1900; - + return res; #else // @@ Same as ACE_OS::localtime (), you need to implement it diff --git a/ace/os_include/os_errno.h b/ace/os_include/os_errno.h index 1a2567e12f2..723489bf8f1 100644 --- a/ace/os_include/os_errno.h +++ b/ace/os_include/os_errno.h @@ -28,6 +28,11 @@ # include /**/ <errno.h> #endif /* !ACE_LACKS_ERRNO_H */ +// Needed for VxWorks to pickup errnoSet() +#if defined (VXWORKS) +#include <errnoLib.h> +#endif /* VXWORKS */ + // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" |