svn_time.h revision 302408
1/** 2 * @copyright 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 * @endcopyright 22 * 23 * @file svn_time.h 24 * @brief Time/date utilities 25 */ 26 27#ifndef SVN_TIME_H 28#define SVN_TIME_H 29 30#include <apr_pools.h> 31#include <apr_time.h> 32 33#include "svn_error.h" 34 35#ifdef __cplusplus 36extern "C" { 37#endif /* __cplusplus */ 38 39 40/** Convert @a when to a <tt>const char *</tt> representation allocated 41 * in @a pool. Use svn_time_from_cstring() for the reverse 42 * conversion. 43 */ 44const char * 45svn_time_to_cstring(apr_time_t when, 46 apr_pool_t *pool); 47 48/** Convert @a data to an @c apr_time_t @a when. 49 * Use @a pool for temporary memory allocation. 50 */ 51svn_error_t * 52svn_time_from_cstring(apr_time_t *when, 53 const char *data, 54 apr_pool_t *pool); 55 56/** Convert @a when to a <tt>const char *</tt> representation allocated 57 * in @a pool, suitable for human display in UTF8. 58 */ 59const char * 60svn_time_to_human_cstring(apr_time_t when, 61 apr_pool_t *pool); 62 63 64/** Convert a human-readable date @a text into an @c apr_time_t, using 65 * @a now as the current time and storing the result in @a result. 66 * The local time zone will be used to compute the appropriate GMT 67 * offset if @a text contains a local time specification. Set @a 68 * matched to indicate whether or not @a text was parsed successfully. 69 * Perform any allocation in @a pool. Return an error iff an internal 70 * error (rather than a simple parse error) occurs. 71 */ 72svn_error_t * 73svn_parse_date(svn_boolean_t *matched, 74 apr_time_t *result, 75 const char *text, 76 apr_time_t now, 77 apr_pool_t *pool); 78 79 80/** Sleep until the next second, to ensure that any files modified 81 * after we exit have a different timestamp than the one we recorded. 82 * 83 * @deprecated Provided for backward compatibility with the 1.5 API. 84 * Use svn_io_sleep_for_timestamps() instead. 85 */ 86SVN_DEPRECATED 87void 88svn_sleep_for_timestamps(void); 89 90#ifdef __cplusplus 91} 92#endif /* __cplusplus */ 93 94#endif /* SVN_TIME_H */ 95