// -*- C++ -*-
//===---------------------------- ctime -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCUDACXX_CTIME
#define _LIBCUDACXX_CTIME

/*
    ctime synopsis

Macros:

    NULL
    CLOCKS_PER_SEC
    TIME_UTC // C++17

namespace std
{

Types:

    clock_t
    size_t
    time_t
    tm
    timespec // C++17

clock_t clock();
double difftime(time_t time1, time_t time0);
time_t mktime(tm* timeptr);
time_t time(time_t* timer);
char* asctime(const tm* timeptr);
char* ctime(const time_t* timer);
tm*    gmtime(const time_t* timer);
tm* localtime(const time_t* timer);
size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
                const tm* restrict timeptr);
int timespec_get( struct timespec *ts, int base); // C++17
}  // std

*/

#include <cuda/std/detail/__config>

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
#  pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
#  pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
#  pragma system_header
#endif // no system header

#if !_CCCL_COMPILER(NVRTC)
#  include <time.h>
#else
typedef long long int time_t;
#endif // _CCCL_COMPILER(NVRTC)

_CCCL_PUSH_MACROS

_LIBCUDACXX_BEGIN_NAMESPACE_STD

using ::clock_t;
using ::size_t;
using ::time_t;

#if !_CCCL_COMPILER(NVRTC)

using ::tm;
#  if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC)
using ::timespec;
#  endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC)
using ::clock;
using ::difftime;
using ::mktime;
using ::time;
#  ifndef _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
using ::asctime;
using ::ctime;
using ::gmtime;
using ::localtime;
#  endif
using ::strftime;
#  if _CCCL_STD_VER >= 2017
using ::timespec_get;
#  endif // _CCCL_STD_VER >= 2017
#endif // _CCCL_COMPILER(NVRTC)

_LIBCUDACXX_END_NAMESPACE_STD

_CCCL_POP_MACROS

#endif // _LIBCUDACXX_CTIME
