# axutil_date_time.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    00017  */
    00018
    00019 #ifndef AXUTIL_DATE_TIME_H
    00020 #define AXUTIL_DATE_TIME_H
    00021
    00022 #include <axutil_utils_defines.h>
    00023 #include <axutil_env.h>
    00024
    00030 #ifdef __cplusplus
    00031 extern "C"
    00032 {
    00033 #endif
    00034
    00041     typedef struct axutil_date_time axutil_date_time_t;
    00042
    00043     typedef enum
    00044     {
    00045         AXIS2_DATE_TIME_COMP_RES_FAILURE = -1,
    00046         AXIS2_DATE_TIME_COMP_RES_UNKNOWN,
    00047         AXIS2_DATE_TIME_COMP_RES_EXPIRED,
    00048         AXIS2_DATE_TIME_COMP_RES_EQUAL,
    00049         AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED
    00050     } axutil_date_time_comp_result_t;
    00051
    00057     AXIS2_EXTERN axutil_date_time_t *AXIS2_CALL
    00058     axutil_date_time_create(
    00059         const axutil_env_t * env);
    00060
    00061     /*
    00062      * Creates axutil_date_time struct with an additional offset value
    00063      * If the offset is a positive value then the time will be in the future
    00064      *        offset is 0, then the time will be the current time
    00065      *        offset is a negative value then the time is in the past.
    00066      * @param env double pointer to environment struct. MUST NOT be NULL
    00067      * @param offset the offset from the current time in seconds
    00068      * @return pointer to newly created axutil_date_time struct
    00069      **/
    00070     AXIS2_EXTERN axutil_date_time_t *AXIS2_CALL
    00071
    00072     axutil_date_time_create_with_offset(
    00073         const axutil_env_t * env,
    00074         int offset);
    00075
    00082     AXIS2_EXTERN void AXIS2_CALL
    00083     axutil_date_time_free(
    00084         axutil_date_time_t * date_time,
    00085         const axutil_env_t * env);
    00086
    00094     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00095     axutil_date_time_deserialize_time(
    00096         axutil_date_time_t * date_time,
    00097         const axutil_env_t * env,
    00098         const axis2_char_t * time_str);
    00099
    00107     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00108     axutil_date_time_deserialize_date(
    00109         axutil_date_time_t * date_time,
    00110         const axutil_env_t * env,
    00111         const axis2_char_t * date_str);
    00112
    00120     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00121
    00122     axutil_date_time_deserialize_date_time(
    00123         axutil_date_time_t * date_time,
    00124         const axutil_env_t * env,
    00125         const axis2_char_t * date_time_str);
    00126
    00139     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00140     axutil_date_time_set_date_time(
    00141         axutil_date_time_t * date_time,
    00142         const axutil_env_t * env,
    00143         int year,
    00144         int month,
    00145         int date,
    00146         int hour,
    00147         int min,
    00148         int second,
    00149         int milliseconds);
    00150
    00157     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00158     axutil_date_time_serialize_time(
    00159         axutil_date_time_t * date_time,
    00160         const axutil_env_t * env);
    00161
    00168     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00169     axutil_date_time_serialize_date(
    00170         axutil_date_time_t * date_time,
    00171         const axutil_env_t * env);
    00172
    00179     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00180
    00181     axutil_date_time_serialize_date_time(
    00182         axutil_date_time_t * date_time,
    00183         const axutil_env_t * env);
    00184
    00191     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00192     axutil_date_time_serialize_date_time_without_millisecond(
    00193         axutil_date_time_t * date_time,
    00194         const axutil_env_t * env);
    00195
    00202     AXIS2_EXTERN int AXIS2_CALL
    00203     axutil_date_time_get_year(
    00204         axutil_date_time_t * date_time,
    00205         const axutil_env_t * env);
    00206
    00213     AXIS2_EXTERN int AXIS2_CALL
    00214     axutil_date_time_get_month(
    00215         axutil_date_time_t * date_time,
    00216         const axutil_env_t * env);
    00217
    00224     AXIS2_EXTERN int AXIS2_CALL
    00225     axutil_date_time_get_date(
    00226         axutil_date_time_t * date_time,
    00227         const axutil_env_t * env);
    00228
    00235     AXIS2_EXTERN int AXIS2_CALL
    00236     axutil_date_time_get_hour(
    00237         axutil_date_time_t * date_time,
    00238         const axutil_env_t * env);
    00239
    00246     AXIS2_EXTERN int AXIS2_CALL
    00247     axutil_date_time_get_minute(
    00248         axutil_date_time_t * date_time,
    00249         const axutil_env_t * env);
    00250
    00257     AXIS2_EXTERN int AXIS2_CALL
    00258     axutil_date_time_get_second(
    00259         axutil_date_time_t * date_time,
    00260         const axutil_env_t * env);
    00261
    00262     AXIS2_EXTERN int AXIS2_CALL
    00263     axutil_date_time_get_msec(
    00264         axutil_date_time_t * date_time,
    00265         const axutil_env_t * env);
    00266
    00277     AXIS2_EXTERN axutil_date_time_comp_result_t AXIS2_CALL
    00278     axutil_date_time_compare(
    00279         axutil_date_time_t * date_time,
    00280         const axutil_env_t * env,
    00281         axutil_date_time_t * ref);
    00282
    00283     AXIS2_EXTERN axutil_date_time_t *AXIS2_CALL
    00284     axutil_date_time_utc_to_local(
    00285         axutil_date_time_t * date_time,
    00286         const axutil_env_t * env,
    00287         axis2_bool_t is_positive,
    00288         int hour,
    00289         int min);
    00290
    00291     AXIS2_EXTERN axutil_date_time_t *AXIS2_CALL
    00292     axutil_date_time_local_to_utc(
    00293         axutil_date_time_t * date_time,
    00294         const axutil_env_t * env);
    00295
    00296     AXIS2_EXTERN int AXIS2_CALL
    00297     axutil_date_time_get_time_zone_hour(
    00298         axutil_date_time_t * date_time,
    00299         const axutil_env_t * env);
    00300
    00301     AXIS2_EXTERN int AXIS2_CALL
    00302     axutil_date_time_get_time_zone_minute(
    00303         axutil_date_time_t * date_time,
    00304         const axutil_env_t * env);
    00305
    00306     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
    00307     axutil_date_time_is_time_zone_positive(
    00308         axutil_date_time_t * date_time,
    00309         const axutil_env_t * env);
    00310
    00311     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00312     axutil_date_time_set_time_zone(
    00313         axutil_date_time_t * date_time,
    00314         const axutil_env_t * env,
    00315         axis2_bool_t is_positive,
    00316         int hour,
    00317         int min);
    00318
    00319     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00320     axutil_date_time_deserialize_date_time_with_time_zone(
    00321         axutil_date_time_t * date_time,
    00322         const axutil_env_t * env,
    00323         const axis2_char_t * date_time_str);
    00324
    00325     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00326     axutil_date_time_deserialize_time_with_time_zone(
    00327         axutil_date_time_t * date_time,
    00328         const axutil_env_t * env,
    00329         const axis2_char_t * time_str);
    00330
    00331     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00332     axutil_date_time_serialize_date_time_with_time_zone(
    00333         axutil_date_time_t * date_time,
    00334         const axutil_env_t * env);
    00335
    00336     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00337     axutil_date_time_serialize_time_with_time_zone(
    00338         axutil_date_time_t * date_time,
    00339         const axutil_env_t * env);
    00340
    00341     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
    00342     axutil_date_time_is_utc(
    00343         axutil_date_time_t * date_time,
    00344         const axutil_env_t * env);
    00345
    00346 #ifdef __cplusplus
    00347 }
    00348 #endif
    00349
    00350 #endif                          /* AXIS2_DATE_TIME_H */