Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

access.c

Go to the documentation of this file.
00001 /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
00002  * applicable.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "win32/apr_arch_atime.h"
00018 #include "apr_time.h"
00019 #include "apr_general.h"
00020 #include "apr_lib.h"
00021 
00022 apr_status_t apr_get_curtime(struct atime_t *time, apr_time_t *rv)
00023 {
00024     if (time) {
00025         (*rv) = time->currtime;
00026         return APR_SUCCESS;
00027     }
00028     return APR_ENOTIME;    
00029 }
00030 
00031 apr_status_t apr_get_sec(struct atime_t *time, apr_int32_t *rv)
00032 {
00033     if (time) {
00034         (*rv) = time->explodedtime->wSecond;
00035         return APR_SUCCESS;
00036     }
00037     return APR_ENOTIME;
00038 }
00039 
00040 apr_status_t apr_get_min(struct atime_t *time, apr_int32_t *rv)
00041 {
00042     if (time) {
00043         (*rv) = time->explodedtime->wMinute;
00044         return APR_SUCCESS;
00045     }
00046     return APR_ENOTIME;
00047 }
00048 
00049 apr_status_t apr_get_hour(struct atime_t *time, apr_int32_t *rv)
00050 {
00051     if (time) {
00052         (*rv) = time->explodedtime->wHour;
00053         return APR_SUCCESS;
00054     }
00055     return APR_ENOTIME;
00056 }
00057 
00058 apr_status_t apr_get_mday(struct atime_t *time, apr_int32_t *rv)
00059 {
00060     if (time) {
00061         (*rv) = time->explodedtime->wDay;
00062         return APR_SUCCESS;
00063     }
00064     return APR_ENOTIME;
00065 }
00066 
00067 apr_status_t apr_get_mon(struct atime_t *time, apr_int32_t *rv)
00068 {
00069     if (time) {
00070         (*rv) = time->explodedtime->wMonth;
00071         return APR_SUCCESS;
00072     }
00073     return APR_ENOTIME;
00074 }
00075 
00076 apr_status_t apr_get_year(struct atime_t *time, apr_int32_t *rv)
00077 {
00078     if (time) {
00079         (*rv) = time->explodedtime->wYear;
00080         return APR_SUCCESS;
00081     }
00082     return APR_ENOTIME;
00083 }
00084 
00085 apr_status_t apr_get_wday(struct atime_t *time, apr_int32_t *rv)
00086 {
00087     if (time) {
00088         (*rv) = time->explodedtime->wDayOfWeek;
00089         return APR_SUCCESS;
00090     }
00091     return APR_ENOTIME;
00092 }
00093 
00094 apr_status_t apr_set_sec(struct atime_t *time, apr_int32_t value)
00095 {
00096     if (!time) {
00097         return APR_ENOTIME;
00098     }
00099     if (time->explodedtime == NULL) {
00100         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00101                               sizeof(SYSTEMTIME));
00102     }
00103     if (time->explodedtime == NULL) {
00104         return APR_ENOMEM;
00105     }
00106     time->explodedtime->wSecond = value;
00107     return APR_SUCCESS;
00108 }
00109 
00110 apr_status_t apr_set_min(struct atime_t *time, apr_int32_t value)
00111 {
00112     if (!time) {
00113         return APR_ENOTIME;
00114     }
00115     if (time->explodedtime == NULL) {
00116         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00117                               sizeof(SYSTEMTIME));
00118     }
00119     if (time->explodedtime == NULL) {
00120         return APR_ENOMEM;
00121     }
00122     time->explodedtime->wMinute = value;
00123     return APR_SUCCESS;
00124 }
00125 
00126 apr_status_t apr_set_hour(struct atime_t *time, apr_int32_t value)
00127 {
00128     if (!time) {
00129         return APR_ENOTIME;
00130     }
00131     if (time->explodedtime == NULL) {
00132         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00133                               sizeof(SYSTEMTIME));
00134     }
00135     if (time->explodedtime == NULL) {
00136         return APR_ENOMEM;
00137     }
00138     time->explodedtime->wHour = value;
00139     return APR_SUCCESS;
00140 }
00141 
00142 apr_status_t apr_set_mday(struct atime_t *time, apr_int32_t value)
00143 {
00144     if (!time) {
00145         return APR_ENOTIME;
00146     }
00147     if (time->explodedtime == NULL) {
00148         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00149                               sizeof(SYSTEMTIME));
00150     }
00151     if (time->explodedtime == NULL) {
00152         return APR_ENOMEM;
00153     }
00154     time->explodedtime->wDay = value;
00155     return APR_SUCCESS;
00156 }
00157 
00158 apr_status_t apr_set_mon(struct atime_t *time, apr_int32_t value)
00159 {
00160     if (!time) {
00161         return APR_ENOTIME;
00162     }
00163     if (time->explodedtime == NULL) {
00164         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00165                               sizeof(SYSTEMTIME));
00166     }
00167     if (time->explodedtime == NULL) {
00168         return APR_ENOMEM;
00169     }
00170     time->explodedtime->wMonth = value;
00171     return APR_SUCCESS;
00172 }
00173 
00174 apr_status_t apr_set_year(struct atime_t *time, apr_int32_t value)
00175 {
00176     if (!time) {
00177         return APR_ENOTIME;
00178     }
00179     if (time->explodedtime == NULL) {
00180         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00181                               sizeof(SYSTEMTIME));
00182     }
00183     if (time->explodedtime == NULL) {
00184         return APR_ENOMEM;
00185     }
00186     time->explodedtime->wYear = value;
00187     return APR_SUCCESS;
00188 }
00189 
00190 apr_status_t apr_set_wday(struct atime_t *time, apr_int32_t value)
00191 {
00192     if (!time) {
00193         return APR_ENOTIME;
00194     }
00195     if (time->explodedtime == NULL) {
00196         time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, 
00197                               sizeof(SYSTEMTIME));
00198     }
00199     if (time->explodedtime == NULL) {
00200         return APR_ENOMEM;
00201     }
00202     time->explodedtime->wDayOfWeek = value;
00203     return APR_SUCCESS;
00204 }