Subversion
svn_time.h
Go to the documentation of this file.
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
36 extern "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  */
44 const char *
45 svn_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  */
52 svn_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  */
59 const char *
60 svn_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  */
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  */
87 void
89 
90 #ifdef __cplusplus
91 }
92 #endif /* __cplusplus */
93 
94 #endif /* SVN_TIME_H */
svn_error_t * svn_parse_date(svn_boolean_t *matched, apr_time_t *result, const char *text, apr_time_t now, apr_pool_t *pool)
Convert a human-readable date text into an apr_time_t, using now as the current time and storing the ...
void svn_sleep_for_timestamps(void)
Sleep until the next second, to ensure that any files modified after we exit have a different timesta...
const char * svn_time_to_cstring(apr_time_t when, apr_pool_t *pool)
Convert when to a const char * representation allocated in pool.
Subversion error object.
Definition: svn_types.h:178
const char * svn_time_to_human_cstring(apr_time_t when, apr_pool_t *pool)
Convert when to a const char * representation allocated in pool, suitable for human display in UTF8...
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
Definition: svn_types.h:60
Common exception handling for Subversion.
svn_error_t * svn_time_from_cstring(apr_time_t *when, const char *data, apr_pool_t *pool)
Convert data to an apr_time_t when.
int svn_boolean_t
YABT: Yet Another Boolean Type.
Definition: svn_types.h:139