00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2004 CollabNet. All rights reserved. 00005 * 00006 * This software is licensed as described in the file COPYING, which 00007 * you should have received as part of this distribution. The terms 00008 * are also available at http://subversion.tigris.org/license-1.html. 00009 * If newer versions of this license are posted there, you may use a 00010 * newer version instead, at your option. 00011 * 00012 * This software consists of voluntary contributions made by many 00013 * individuals. For exact contribution history, see the revision 00014 * history and logs, available at http://subversion.tigris.org/. 00015 * ==================================================================== 00016 * @endcopyright 00017 * 00018 * @file svn_time.h 00019 * @brief Time/date utilities 00020 */ 00021 00022 #ifndef SVN_TIME_H 00023 #define SVN_TIME_H 00024 00025 #include <apr_pools.h> 00026 #include <apr_time.h> 00027 00028 #include "svn_error.h" 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif /* __cplusplus */ 00033 00034 00035 /** Convert @a when to a <tt>const char *</tt> representation allocated 00036 * in @a pool. Use svn_time_from_cstring() for the reverse 00037 * conversion. 00038 */ 00039 const char *svn_time_to_cstring (apr_time_t when, apr_pool_t *pool); 00040 00041 /** Convert @a data to an @c apr_time_t @a when. 00042 * Use @a pool for temporary memory allocation. 00043 */ 00044 svn_error_t *svn_time_from_cstring (apr_time_t *when, const char *data, 00045 apr_pool_t *pool); 00046 00047 /** Convert @a when to a <tt>const char *</tt> representation allocated 00048 * in @a pool, suitable for human display in UTF8. 00049 */ 00050 const char *svn_time_to_human_cstring (apr_time_t when, apr_pool_t *pool); 00051 00052 00053 /** Convert a human-readable date @a text into an @c apr_time_t, using 00054 * @a now as the current time and storing the result in @a result. 00055 * The local time zone will be used to compute the appropriate GMT 00056 * offset if @a text contains a local time specification. Set @a 00057 * matched to indicate whether or not @a text was parsed successfully. 00058 * Perform any allocation in @a pool. Return an error iff an internal 00059 * error (rather than a simple parse error) occurs. 00060 */ 00061 svn_error_t * 00062 svn_parse_date (svn_boolean_t *matched, apr_time_t *result, const char *text, 00063 apr_time_t now, apr_pool_t *pool); 00064 00065 00066 /** Sleep until the next second, to ensure that any files modified 00067 * after we exit have a different timestamp than the one we recorded. 00068 */ 00069 void svn_sleep_for_timestamps (void); 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif /* __cplusplus */ 00074 00075 #endif /* SVN_TIME_H */