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.
42 *
43 * @see svn_time_from_cstring() for the reverse conversion.
44 */
45const char *
46svn_time_to_cstring(apr_time_t when,
47                    apr_pool_t *pool);
48
49/** Convert @a data to an @c apr_time_t @a when.
50 *
51 * @see svn_time_to_cstring() for the reverse conversion.
52 *
53 * @deprecated Also accepts a format that was used before Subversion 0.14.
54 * See implementation for details. Use of this format is deprecated.
55 *
56 * Use @a pool for temporary memory allocation.
57 */
58svn_error_t *
59svn_time_from_cstring(apr_time_t *when,
60                      const char *data,
61                      apr_pool_t *pool);
62
63/** Convert @a when to a <tt>const char *</tt> representation allocated
64 * in @a pool, suitable for human display in UTF8.
65 */
66const char *
67svn_time_to_human_cstring(apr_time_t when,
68                          apr_pool_t *pool);
69
70
71/** Convert a human-readable date @a text into an @c apr_time_t, using
72 * @a now as the current time and storing the result in @a result.
73 * The local time zone will be used to compute the appropriate GMT
74 * offset if @a text contains a local time specification.  Set @a
75 * matched to indicate whether or not @a text was parsed successfully.
76 * Perform any allocation in @a pool.  Return an error iff an internal
77 * error (rather than a simple parse error) occurs.
78 */
79svn_error_t *
80svn_parse_date(svn_boolean_t *matched,
81               apr_time_t *result,
82               const char *text,
83               apr_time_t now,
84               apr_pool_t *pool);
85
86
87/** Sleep until the next second, to ensure that any files modified
88 * after we exit have a different timestamp than the one we recorded.
89 *
90 * @deprecated Provided for backward compatibility with the 1.5 API.
91 * Use svn_io_sleep_for_timestamps() instead.
92 */
93SVN_DEPRECATED
94void
95svn_sleep_for_timestamps(void);
96
97#ifdef __cplusplus
98}
99#endif /* __cplusplus */
100
101#endif /* SVN_TIME_H */
102