1 //===---- TmHelper.h ------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_TEST_SRC_TIME_TM_HELPER_H
10 #define LLVM_LIBC_TEST_SRC_TIME_TM_HELPER_H
14 #include "src/time/time_utils.h"
16 using LIBC_NAMESPACE::time_utils::TimeConstants
;
18 namespace LIBC_NAMESPACE
{
22 // A helper function to initialize tm data structure.
23 static inline void initialize_tm_data(struct tm
*tm_data
, int year
, int month
,
24 int mday
, int hour
, int min
, int sec
,
26 struct tm temp
= {.tm_sec
= sec
,
30 .tm_mon
= month
- 1, // tm_mon starts with 0 for Jan
32 .tm_year
= year
- TimeConstants::TIME_YEAR_BASE
,
39 } // namespace testing
40 } // namespace tmhelper
41 } // namespace LIBC_NAMESPACE
43 #endif // LLVM_LIBC_TEST_SRC_TIME_TM_HELPER_H