summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2001-04-17 02:20:19 +0000
committerBrian Havard <bjh@apache.org>2001-04-17 02:20:19 +0000
commit5d41bfc69edf1919d73034b76eaf47f888488008 (patch)
tree65f89518b2e31f2020050733d3be4cd6d3572d21 /time
parentf6d539eed824e25dd93fcac66556b904d9279a69 (diff)
downloadapr-5d41bfc69edf1919d73034b76eaf47f888488008.tar.gz
Fix OS/2 build where we have no gmtime_r (or an *_r's for that matter) or
tm_gmtoff. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r--time/unix/time.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/time/unix/time.c b/time/unix/time.c
index c399f56d3..32930db8e 100644
--- a/time/unix/time.c
+++ b/time/unix/time.c
@@ -95,7 +95,11 @@ static void set_xt_gmtoff_from_tm(apr_exploded_time_t *xt, struct tm *tm,
{
struct tm t;
int days = 0, hours = 0, minutes = 0;
+#ifdef HAVE_GMTIME_R
gmtime_r(tt, &t);
+#else
+ t = *gmtime(tt);
+#endif
days = xt->tm_yday - t.tm_yday;
hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) +
xt->tm_hour - t.tm_hour);
@@ -145,6 +149,10 @@ apr_status_t apr_explode_gmt(apr_exploded_time_t *result, apr_time_t input)
apr_status_t apr_explode_localtime(apr_exploded_time_t *result, apr_time_t input)
{
+#if defined(__EMX__)
+ /* EMX gcc (OS/2) has a timezone global we can use */
+ return apr_explode_time(result, input, -timezone);
+#else
time_t mango = input / APR_USEC_PER_SEC;
apr_int32_t offs = 0;
@@ -163,6 +171,7 @@ apr_status_t apr_explode_localtime(apr_exploded_time_t *result, apr_time_t input
offs = mangotm->tm_gmtoff;
#endif
return apr_explode_time(result, input, offs);
+#endif /* __EMX__ */
}
apr_status_t apr_implode_time(apr_time_t *t, apr_exploded_time_t *xt)
@@ -246,7 +255,7 @@ void apr_sleep(apr_interval_time_t t)
{
#ifdef OS2
DosSleep(t/1000);
-#elseif defined(BEOS)
+#elif defined(BEOS)
snooze(t);
#else
struct timeval tv;