diff options
author | (no author) <(no author)@unknown> | 1999-08-24 05:50:38 +0000 |
---|---|---|
committer | (no author) <(no author)@unknown> | 1999-08-24 05:50:38 +0000 |
commit | 6154ab7b1e862927c90ae6afa4dc6c57ee657ceb (patch) | |
tree | 9600a7a8672c30de1b898febf0383af458593f20 /time | |
parent | 0dc12a018bb675ccf2859e3785702d5d2982646d (diff) | |
download | apr-APACHE_1_3_9.tar.gz apr-APACHE_1_3_9.zip |
This commit was manufactured by cvs2svn to create tag 'APACHE_1_3_9'.APACHE_1_3_9
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/tags/APACHE_1_3_9@59168 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r-- | time/beos/Makefile.in | 60 | ||||
-rw-r--r-- | time/beos/access.c | 245 | ||||
-rw-r--r-- | time/beos/atime.h | 70 | ||||
-rw-r--r-- | time/beos/time.c | 132 | ||||
-rw-r--r-- | time/os2/Makefile.in | 60 | ||||
-rw-r--r-- | time/os2/access.c | 247 | ||||
-rw-r--r-- | time/os2/atime.h | 70 | ||||
-rw-r--r-- | time/os2/time.c | 134 | ||||
-rw-r--r-- | time/unix/.cvsignore | 1 | ||||
-rw-r--r-- | time/unix/Makefile.in | 64 | ||||
-rw-r--r-- | time/unix/access.c | 370 | ||||
-rw-r--r-- | time/unix/atime.h | 70 | ||||
-rw-r--r-- | time/unix/time.c | 222 | ||||
-rw-r--r-- | time/win32/access.c | 267 | ||||
-rw-r--r-- | time/win32/atime.h | 70 | ||||
-rw-r--r-- | time/win32/time.c | 158 | ||||
-rw-r--r-- | time/win32/time.def | 30 | ||||
-rw-r--r-- | time/win32/time.dsp | 105 |
18 files changed, 0 insertions, 2375 deletions
diff --git a/time/beos/Makefile.in b/time/beos/Makefile.in deleted file mode 100644 index d31daa7e9..000000000 --- a/time/beos/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -#LIBS=$(EXTRA_LIBS) $(LIBS1) -#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) - -CC=@CC@ -RANLIB=@RANLIB@ -CFLAGS=@CFLAGS@ @OPTIM@ -LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ $(LIBS) -INCDIR=../../inc -INCDIR1=../../include -INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. - -LIB=../libtime.a - -OBJS=time.o \ - access.o - -.c.o: - $(CC) $(CFLAGS) -c $(INCLUDES) $< - -all: $(LIB) - -clean: - $(RM) -f *.o *.a *.so - -distclean: clean - -$(RM) -f Makefile - -$(OBJS): Makefile - -$(LIB): $(OBJS) - $(RM) -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -# -# We really don't expect end users to use this rule. It works only with -# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after -# using it. -# -depend: - cp Makefile.in Makefile.in.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \ - && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ - && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ - -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ - > Makefile.in \ - && rm Makefile.new - -# DO NOT REMOVE -access.o: access.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_errno.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h -time.o: time.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_errno.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h diff --git a/time/beos/access.c b/time/beos/access.c deleted file mode 100644 index 5c9297782..000000000 --- a/time/beos/access.c +++ /dev/null @@ -1,245 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <errno.h> -#include <string.h> - -ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv) -{ - if (time) { - (*rv) = time->currtime; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_sec; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_min; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_hour; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mon; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_year; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_wday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_sec = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_min = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_hour = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mday = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mon = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_year = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_wday = value; - return APR_SUCCESS; -} diff --git a/time/beos/atime.h b/time/beos/atime.h deleted file mode 100644 index 6f036a5aa..000000000 --- a/time/beos/atime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef ATIME_H -#define ATIME_H - -#include "apr_time.h" -#include <time.h> - -struct atime_t { - ap_context_t *cntxt; - time_t currtime; - struct tm *explodedtime; -}; - - -#endif /* ! ATIME_H */ - diff --git a/time/beos/time.c b/time/beos/time.c deleted file mode 100644 index f1dc3c9e2..000000000 --- a/time/beos/time.c +++ /dev/null @@ -1,132 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <time.h> -#include <errno.h> -#include <string.h> -ap_status_t ap_make_time(ap_context_t *cont, struct atime_t **new) -{ - (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->explodedtime = NULL; - return APR_SUCCESS; -} - -ap_status_t ap_current_time(struct atime_t *new) -{ - if (time(&new->currtime) == -1) { - return errno; - } - return APR_SUCCESS; -} - -ap_status_t ap_explode_time(struct atime_t *time, ap_timetype_e type) -{ - switch (type) { - case APR_LOCALTIME: { - time->explodedtime = localtime(&time->currtime); - break; - } - case APR_UTCTIME: { - time->explodedtime = gmtime(&time->currtime); - break; - } - } - return APR_SUCCESS; -} - -ap_status_t ap_implode_time(struct atime_t *time) -{ - int year; - time_t days; - static const int dayoffset[12] = - {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; - - year = time->explodedtime->tm_year; - - if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) { - return APR_EBADDATE; - } - - /* shift new year to 1st March in order to make leap year calc easy */ - - if (time->explodedtime->tm_mon < 2) - year--; - - /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ - - days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; - days += dayoffset[time->explodedtime->tm_mon] + - time->explodedtime->tm_mday - 1; - days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - - days = ((days * 24 + time->explodedtime->tm_hour) * 60 + - time->explodedtime->tm_min) * 60 + time->explodedtime->tm_sec; - - if (days < 0) { - return APR_EBADDATE; - } - time->currtime = days; /* must be a valid time */ - return APR_SUCCESS; -} diff --git a/time/os2/Makefile.in b/time/os2/Makefile.in deleted file mode 100644 index b1507122f..000000000 --- a/time/os2/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -#LIBS=$(EXTRA_LIBS) $(LIBS1) -#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) - -CC=@CC@ -RANLIB=@RANLIB@ -CFLAGS=@CFLAGS@ @OPTIM@ -LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ $(LIBS) -INCDIR=../../inc -INCDIR1=../../include -INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. - -LIB=../time.a - -OBJS=time.o \ - access.o - -.c.o: - $(CC) $(CFLAGS) -c $(INCLUDES) $< - -all: $(LIB) - -clean: - $(RM) -f *.o *.a *.so - -distclean: clean - -$(RM) -f Makefile - -$(OBJS): Makefile - -$(LIB): $(OBJS) - $(RM) -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -# -# We really don't expect end users to use this rule. It works only with -# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after -# using it. -# -depend: - cp Makefile.in Makefile.in.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \ - && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ - && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ - -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ - > Makefile.in \ - && rm Makefile.new - -# DO NOT REMOVE -access.o: access.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_errno.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h -time.o: time.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_errno.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h diff --git a/time/os2/access.c b/time/os2/access.c deleted file mode 100644 index df19aee6f..000000000 --- a/time/os2/access.c +++ /dev/null @@ -1,247 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <errno.h> -#include <string.h> - -ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv) -{ - if (time) { - (*rv) = time->currtime; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_sec; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_min; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_hour; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mon; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_year; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_wday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_sec = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_min = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_hour = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mday = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mon = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_year = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_wday = value; - return APR_SUCCESS; -} - - diff --git a/time/os2/atime.h b/time/os2/atime.h deleted file mode 100644 index 6f036a5aa..000000000 --- a/time/os2/atime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef ATIME_H -#define ATIME_H - -#include "apr_time.h" -#include <time.h> - -struct atime_t { - ap_context_t *cntxt; - time_t currtime; - struct tm *explodedtime; -}; - - -#endif /* ! ATIME_H */ - diff --git a/time/os2/time.c b/time/os2/time.c deleted file mode 100644 index 2b0e7a2a1..000000000 --- a/time/os2/time.c +++ /dev/null @@ -1,134 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <time.h> -#include <errno.h> -#include <string.h> - -ap_status_t ap_make_time(ap_context_t *cont, struct atime_t **new) -{ - (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->explodedtime = NULL; - return APR_SUCCESS; -} - -ap_status_t ap_current_time(struct atime_t *new) -{ - if (time(&new->currtime) == -1) { - return errno; - } - return APR_SUCCESS; -} - -ap_status_t ap_explode_time(struct atime_t *time, ap_timetype_e type) -{ - switch (type) { - case APR_LOCALTIME: { - time->explodedtime = localtime(&time->currtime); - break; - } - case APR_UTCTIME: { - time->explodedtime = gmtime(&time->currtime); - break; - } - } - return APR_SUCCESS; -} - -ap_status_t ap_implode_time(struct atime_t *time) -{ - int year; - time_t days; - static const int dayoffset[12] = - {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; - - year = time->explodedtime->tm_year; - - if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) { - return APR_EBADDATE; - } - - /* shift new year to 1st March in order to make leap year calc easy */ - - if (time->explodedtime->tm_mon < 2) - year--; - - /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ - - days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; - days += dayoffset[time->explodedtime->tm_mon] + - time->explodedtime->tm_mday - 1; - days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - - days = ((days * 24 + time->explodedtime->tm_hour) * 60 + - time->explodedtime->tm_min) * 60 + time->explodedtime->tm_sec; - - if (days < 0) { - return APR_EBADDATE; - } - time->currtime = days; /* must be a valid time */ - return APR_SUCCESS; -} - diff --git a/time/unix/.cvsignore b/time/unix/.cvsignore deleted file mode 100644 index f3c7a7c5d..000000000 --- a/time/unix/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile diff --git a/time/unix/Makefile.in b/time/unix/Makefile.in deleted file mode 100644 index 720351856..000000000 --- a/time/unix/Makefile.in +++ /dev/null @@ -1,64 +0,0 @@ -#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -#LIBS=$(EXTRA_LIBS) $(LIBS1) -#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) - -RM=@RM@ -CC=@CC@ -RANLIB=@RANLIB@ -CFLAGS=@CFLAGS@ @OPTIM@ -LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ $(LIBS) -INCDIR=../../inc -INCDIR1=../../include -INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. - -LIB=../libtime.a - -OBJS=time.o \ - access.o - -.c.o: - $(CC) $(CFLAGS) -c $(INCLUDES) $< - -all: $(LIB) - -clean: - $(RM) -f *.o *.a *.so - -distclean: clean - -$(RM) -f Makefile - -$(OBJS): Makefile - -$(LIB): $(OBJS) - $(RM) -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -# -# We really don't expect end users to use this rule. It works only with -# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after -# using it. -# -depend: - cp Makefile.in Makefile.in.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \ - && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ - && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ - -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ - > Makefile.in \ - && rm Makefile.new - -# DO NOT REMOVE -access.o: access.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_config.h \ - ../../include/apr_errno.h ../../include/apr_lib.h \ - ../../include/apr_file_io.h ../../include/hsregex.h -time.o: time.c atime.h ../../include/apr_time.h \ - ../../include/apr_general.h ../../include/apr_config.h \ - ../../include/apr_errno.h ../../include/apr_lib.h \ - ../../include/apr_file_io.h ../../include/hsregex.h \ - ../../include/apr_portable.h ../../include/apr_thread_proc.h \ - ../../include/apr_win.h ../../include/apr_network_io.h \ - ../../include/apr_lock.h diff --git a/time/unix/access.c b/time/unix/access.c deleted file mode 100644 index bae1cbf01..000000000 --- a/time/unix/access.c +++ /dev/null @@ -1,370 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include <errno.h> -#include <string.h> - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_curtime(ap_time_t *, ap_int64_t *) - * Get the current time in seconds since Jan 1, 1970. - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv) -{ - if (time) { - (*rv) = time->currtime->tv_sec; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_sec(ap_time_t *, ap_int64_t *) - * Get the number of seconds since the top of the minute - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_sec; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_min(ap_time_t *, ap_int64_t *) - * Get the number of minutes since the top of the hour - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_min; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_min(ap_time_t *, ap_int64_t *) - * Get the number of minutes since the top of the hour - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_hour; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_mday(ap_time_t *, ap_int64_t *) - * Get the number of days since the beginning of the month - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_mon(ap_time_t *, ap_int64_t *) - * Get the number of months since the beginning of the year - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_mon; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_year(ap_time_t *, ap_int64_t *) - * Get the number of years since 1900 - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_year; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_wday(ap_time_t *, ap_int64_t *) - * Get the number of days since the beginning of the week. 0 == Sunday - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->tm_wday; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_sec(ap_time_t *, ap_int64_t) - * Set the number of sec since the top of the minute - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_sec = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_min(ap_time_t *, ap_int64_t) - * Set the number of minutes since the top of the hour - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_min = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_min(ap_time_t *, ap_int64_t) - * Set the number of hours since the beginning of the day - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_hour = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_mday(ap_time_t *, ap_int64_t) - * Set the number of days since the beginning of the month - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mday = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_mon(ap_time_t *, ap_int64_t) - * Set the number of months since the beginning of the year - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_mon = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_min(ap_time_t *, ap_int64_t) - * Set the number of years since the 1900 - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_year = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_wday(ap_time_t *, ap_int64_t) - * Get the number of days since the beginning of the week. 0 == Sunday - * arg 1) The time value we care about. - * arg 2) Integer to store time value in - */ -ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (struct tm *)ap_palloc(time->cntxt, - sizeof(struct tm)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->tm_wday = value; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_timedata(ap_time_t *, void *) - * Return the context associated with the current atime. - * arg 1) The currently open atime. - * arg 2) The user data associated with the atime. - */ -ap_status_t ap_get_timedata(struct atime_t *atime, void *data) -{ - if (atime != NULL) { - return ap_get_userdata(atime->cntxt, &data); - } - else { - data = NULL; - return APR_ENOTIME; - } -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_set_timedata(ap_time_t *, void *) - * Set the context associated with the current atime. - * arg 1) The currently open atime. - * arg 2) The user data to associate with the atime. - */ -ap_status_t ap_set_timedata(struct atime_t *atime, void *data) -{ - if (atime != NULL) { - return ap_set_userdata(atime->cntxt, data); - } - else { - data = NULL; - return APR_ENOTIME; - } -} - diff --git a/time/unix/atime.h b/time/unix/atime.h deleted file mode 100644 index 772150dce..000000000 --- a/time/unix/atime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef ATIME_H -#define ATIME_H - -#include "apr_time.h" -#include <sys/time.h> - -struct atime_t { - ap_context_t *cntxt; - struct timeval *currtime; - struct tm *explodedtime; -}; - - -#endif /* ! ATIME_H */ - diff --git a/time/unix/time.c b/time/unix/time.c deleted file mode 100644 index f32491d53..000000000 --- a/time/unix/time.c +++ /dev/null @@ -1,222 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include <time.h> -#include <errno.h> -#include <string.h> - -/* ***APRDOC******************************************************** - * ap_status_t ap_make_time(ap_context_t *, ap_time_t *) - * Create a time entity. - * arg 1) The context to operate on. - * arg 2) The new time entity to create. - */ -ap_status_t ap_make_time(ap_context_t *cont, struct atime_t **new) -{ - (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->explodedtime = NULL; - (*new)->currtime = NULL; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_current_time(ap_time_t *) - * Return the number of seconds since January 1, 1970. - * arg 1) The time entity to reference. - */ -ap_status_t ap_current_time(struct atime_t *new) -{ - struct timeval newtime; - new->currtime = ap_palloc(new->cntxt, sizeof(struct timeval)); - gettimeofday(new->currtime, NULL); - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_explode_time(ap_time_t *, ap_timetype_e) - * Convert time value from number of seconds since epoch to a set - * of integers representing the time in a human readable form. - * arg 1) The time entity to reference. - * arg 2) How to explode the time. One of: - * APR_LOCALTIME -- Use local time - * APR_UTCTIME -- Use UTC time - */ -ap_status_t ap_explode_time(struct atime_t *atime, ap_timetype_e type) -{ - switch (type) { - case APR_LOCALTIME: { - atime->explodedtime = localtime(&atime->currtime->tv_sec); - break; - } - case APR_UTCTIME: { - atime->explodedtime = gmtime(&atime->currtime->tv_sec); - break; - } - } - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_implode_time(ap_time_t *) - * Convert time value from human readable format to number of seconds - * since epoch - * arg 1) The time entity to reference. - */ -ap_status_t ap_implode_time(struct atime_t *atime) -{ - int year; - time_t days; - static const int dayoffset[12] = - {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; - - year = atime->explodedtime->tm_year; - - if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) { - return APR_EBADDATE; - } - - /* shift new year to 1st March in order to make leap year calc easy */ - - if (atime->explodedtime->tm_mon < 2) - year--; - - /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ - - days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; - days += dayoffset[atime->explodedtime->tm_mon] + - atime->explodedtime->tm_mday - 1; - days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - - days = ((days * 24 + atime->explodedtime->tm_hour) * 60 + - atime->explodedtime->tm_min) * 60 + atime->explodedtime->tm_sec; - - if (days < 0) { - return APR_EBADDATE; - } - atime->currtime = ap_palloc(atime->cntxt, sizeof(struct timeval)); - atime->currtime->tv_sec = days; /* must be a valid time */ - atime->currtime->tv_usec = 0; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_get_os_time(ap_time_t *, ap_os_time_t *) - * Convert from apr time type to OS specific time value - * arg 1) The time value to convert. - * arg 2) The OS specific value to convert to. - */ -ap_status_t ap_get_os_time(struct atime_t *thetime, ap_os_time_t **atime) -{ - if (thetime == NULL) { - return APR_ENOTIME; - } - if (thetime->currtime == NULL) { - ap_implode_time(thetime); - } - atime = &(thetime->currtime); - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_put_os_time(ap_context_t *, ap_time_t **, ap_os_time_t *) - * Convert to apr time type from OS specific time value - * arg 1) The context to use. - * arg 2) The time value to convert to. - * arg 3) The OS specific value to convert. - */ -ap_status_t ap_put_os_time(ap_context_t *cont, struct atime_t **thetime, - ap_os_time_t *atime) -{ - if (cont == NULL) { - return APR_ENOCONT; - } - if (thetime == NULL) { - (*thetime) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - (*thetime)->cntxt = cont; - } - (*thetime)->currtime = atime; - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_timediff(ap_time_t *, ap_time_t *, ap_int32_t *) - * Retrieve the difference between two time structures in milliseconds. - * arg 1) The first time value - * arg 2) The second timevalue - * arg 3) The difference to return. - */ -ap_status_t ap_timediff(struct atime_t *a, struct atime_t *b, ap_int32_t *rv) -{ - register int us, s; - - us = a->currtime->tv_usec - b->currtime->tv_usec; - us /= 1000; - s = a->currtime->tv_sec - b->currtime->tv_sec; - s *= 1000; - *rv = s + us; - return APR_SUCCESS; -} - diff --git a/time/win32/access.c b/time/win32/access.c deleted file mode 100644 index 2e80e3b66..000000000 --- a/time/win32/access.c +++ /dev/null @@ -1,267 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTwARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED wARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED wARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOwEVER CAUSED AND ON ANY THEORY OF LIABILITY, wHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERwISE) - * ARISING IN ANY wAY OUT OF THE USE OF THIS SOFTwARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" - -ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv) -{ - if (time) { - (*rv) = time->currtime; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wSecond; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wMinute; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wHour; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wDay; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wMonth; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wYear; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv) -{ - if (time) { - (*rv) = time->explodedtime->wDayOfWeek; - return APR_SUCCESS; - } - return APR_ENOTIME; -} - -ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wSecond = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wMinute = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wHour = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wDay = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wMonth = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wYear = value; - return APR_SUCCESS; -} - -ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value) -{ - if (!time) { - return APR_ENOTIME; - } - if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)ap_pcalloc(time->cntxt, - sizeof(SYSTEMTIME)); - } - if (time->explodedtime == NULL) { - return APR_ENOMEM; - } - time->explodedtime->wDayOfWeek = value; - return APR_SUCCESS; -} - -ap_status_t ap_get_timedata(struct atime_t *atime, void *data) -{ - if (atime != NULL) { - return ap_get_userdata(atime->cntxt, &data); - } - else { - data = NULL; - return APR_ENOTIME; - } -} - -ap_status_t ap_set_timedata(struct atime_t *atime, void *data) -{ - if (atime != NULL) { - return ap_set_userdata(atime->cntxt, data); - } - else { - data = NULL; - return APR_ENOTIME; - } -} - - diff --git a/time/win32/atime.h b/time/win32/atime.h deleted file mode 100644 index cba8000da..000000000 --- a/time/win32/atime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef ATIME_H -#define ATIME_H - -#include "apr_time.h" -#include <time.h> - -struct atime_t { - ap_context_t *cntxt; - time_t currtime; - SYSTEMTIME *explodedtime; -}; - - -#endif /* ! ATIME_H */ - diff --git a/time/win32/time.c b/time/win32/time.c deleted file mode 100644 index b61a547f9..000000000 --- a/time/win32/time.c +++ /dev/null @@ -1,158 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include <time.h> -#include <errno.h> -#include <string.h> - -ap_status_t ap_make_time(ap_context_t *cont, struct atime_t **new) -{ - (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->currtime = -1; - (*new)->explodedtime = NULL; - return APR_SUCCESS; -} - -ap_status_t ap_current_time(struct atime_t *new) -{ - if (!new) { - return APR_ENOTIME; - } - if (new->explodedtime == NULL) { - new->explodedtime = (SYSTEMTIME *)ap_palloc(new->cntxt, sizeof(SYSTEMTIME)); - } - GetSystemTime(new->explodedtime); - return APR_SUCCESS; -} - -ap_status_t ap_explode_time(struct atime_t *atime, ap_timetype_e type) -{ - if (!atime || !atime->explodedtime) { - return APR_ENOTIME; - } - return APR_SUCCESS; -} - -ap_status_t ap_implode_time(struct atime_t *atime) -{ - FILETIME temp; - - if (!atime || !atime->explodedtime) { - return APR_ENOTIME; - } - - if (SystemTimeToFileTime(atime->explodedtime, &temp) == 0) { - return APR_EEXIST; - } - atime->currtime = WinTimeToUnixTime(&temp); - return APR_SUCCESS; -} - -ap_status_t ap_get_os_time(struct atime_t *thetime, ap_os_time_t **atime) -{ - if (thetime == NULL) { - return APR_ENOTIME; - } - if (thetime->explodedtime == NULL) { - ap_explode_time(thetime, APR_LOCALTIME); - } - *atime = thetime->explodedtime; - return APR_SUCCESS; -} - -ap_status_t ap_put_os_time(ap_context_t *cont, struct atime_t **thetime, - ap_os_time_t *atime) -{ - if (cont == NULL) { - return APR_ENOCONT; - } - if (thetime == NULL) { - (*thetime) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t)); - (*thetime)->cntxt = cont; - } - (*thetime)->explodedtime = atime; - return APR_SUCCESS; -} - -ap_status_t ap_timediff(struct atime_t *a, struct atime_t *b, ap_int32_t *rv) -{ - FILETIME fa, fb; - LONGLONG ia = 0, ib = 0; - - SystemTimeToFileTime(a->explodedtime, &fa); - SystemTimeToFileTime(b->explodedtime, &fb); - - ia = fa.dwHighDateTime; - ia = ia << 32; - ia |= fa.dwLowDateTime; - - ib = fb.dwHighDateTime; - ib = ib << 32; - ib |= fb.dwLowDateTime; - - *rv = (int)((ia - ib) / 10000); - return APR_SUCCESS; -}
\ No newline at end of file diff --git a/time/win32/time.def b/time/win32/time.def deleted file mode 100644 index ca5675dcb..000000000 --- a/time/win32/time.def +++ /dev/null @@ -1,30 +0,0 @@ -; time.def : - -LIBRARY time -DESCRIPTION '' - -EXPORTS - ; Add new API calls to the end of this list. - ap_make_time @1 - ap_current_time @2 - ap_explode_time @3 - ap_implode_time @4 - ap_get_curtime @5 - ap_get_sec @6 - ap_get_min @7 - ap_get_hour @8 - ap_get_mday @9 - ap_get_mon @10 - ap_get_year @11 - ap_get_wday @12 - ap_set_sec @13 - ap_set_min @14 - ap_set_hour @15 - ap_set_mday @16 - ap_set_mon @17 - ap_set_year @18 - ap_set_wday @19 - ap_get_timedata @20 - ap_set_timedata @21 - ap_get_os_time @22 - ap_timediff @23
\ No newline at end of file diff --git a/time/win32/time.dsp b/time/win32/time.dsp deleted file mode 100644 index 738732859..000000000 --- a/time/win32/time.dsp +++ /dev/null @@ -1,105 +0,0 @@ -# Microsoft Developer Studio Project File - Name="time" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=time - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "time.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "time.mak" CFG="time - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "time - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "time - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "time - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include ..\..\inc" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "time - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /I "..\..\include" /I "..\..\inc" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\lib\Debug\lib.lib ..\..\misc\win32\Debug\misc.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "time - Win32 Release" -# Name "time - Win32 Debug" -# Begin Source File - -SOURCE=.\access.c -# End Source File -# Begin Source File - -SOURCE=.\atime.h -# End Source File -# Begin Source File - -SOURCE=.\time.c -# End Source File -# Begin Source File - -SOURCE=.\time.def -# End Source File -# End Target -# End Project |