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 23struct time_test_string_struct { 24 const char *tz; 25 const char *result; 26}; 27 28struct time_test_double_struct { 29 const char *tz; 30 const double result; 31}; 32 33struct time_test_time_struct { 34 const char *tz; 35 const time_t result; 36}; 37 38static const char *test_handle_path(const char *tz) 39{ 40 const char *p = tz; 41 if (tz) { 42#ifdef TIME_ZONE_SUB_TAG 43 char *str = strrchr(tz, TIME_ZONE_SUB_TAG); 44 if (str) { 45 p = ++str; 46 } 47#endif 48 } 49 return p; 50} 51 52#endif 53