diff options
author | brane <brane@13f79535-47bb-0310-9956-ffa450edef68> | 2001-06-30 09:50:30 +0000 |
---|---|---|
committer | brane <brane@13f79535-47bb-0310-9956-ffa450edef68> | 2001-06-30 09:50:30 +0000 |
commit | f6c873d7d717db6118240b3d6b4c55e8ce19fccf (patch) | |
tree | 6195c6554db9a2e3dca65daede9dda04fe32f456 /time | |
parent | c8d0e19954d6682a132cb7a1e3eb78fd5ae318d6 (diff) | |
download | libapr-f6c873d7d717db6118240b3d6b4c55e8ce19fccf.tar.gz |
Added new function apr_implode_gmt, which works like apr_implode_time, except
that it always produces an apr_time_t that represents GMT.
* include/apr_time.h (apr_implode_gmt): New function.
* time/unix/time.c, time/win32/time.c: Implement it.
* test/testtime.c: Test it. The test is analogous to the apr_implode_time test.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61832 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r-- | time/unix/time.c | 8 | ||||
-rw-r--r-- | time/win32/time.c | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/time/unix/time.c b/time/unix/time.c index 085c9aa8d..a39ca75a8 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -193,6 +193,14 @@ apr_status_t apr_implode_time(apr_time_t *t, apr_exploded_time_t *xt) return APR_SUCCESS; } +apr_status_t apr_implode_gmt(apr_time_t *t, apr_exploded_time_t *xt) +{ + apr_status_t status = apr_implode_time(t, xt); + if (status == APR_SUCCESS) + *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; + return status; +} + apr_status_t apr_os_imp_time_get(apr_os_imp_time_t **ostime, apr_time_t *aprtime) { (*ostime)->tv_usec = *aprtime % APR_USEC_PER_SEC; diff --git a/time/win32/time.c b/time/win32/time.c index 18356de10..a82374918 100644 --- a/time/win32/time.c +++ b/time/win32/time.c @@ -210,6 +210,15 @@ APR_DECLARE(apr_status_t) apr_implode_time(apr_time_t *t, return APR_SUCCESS; } +APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t, + apr_exploded_time_t *xt) +{ + apr_status_t status = apr_implode_time(t, xt); + if (status == APR_SUCCESS) + *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; + return status; +} + APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime, apr_time_t *aprtime) { |