• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *   http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __TIME_TEST_DATA_H__
17 #define __TIME_TEST_DATA_H__
18 
19 #include <stdlib.h>
20 #include <string.h>
21 #include <time.h>
22 
23 #define TIME_ZONE_SUB_TAG '/'
24 
25 struct time_test_string_struct {
26     const char *tz;
27     const char *result;
28 };
29 
30 struct time_test_double_struct {
31     const char *tz;
32     const double result;
33 };
34 
35 struct time_test_time_struct {
36     const char *tz;
37     const time_t result;
38 };
39 
test_handle_path(const char * tz)40 static const char *test_handle_path(const char *tz)
41 {
42     const char *p = tz;
43     if (tz) {
44 #ifdef TIME_ZONE_SUB_TAG
45         char *str = strrchr(tz, TIME_ZONE_SUB_TAG);
46         if (str) {
47             p = ++str;
48         }
49 #endif
50     }
51     return p;
52 }
53 
54 #endif
55