brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ff95199 Raw
40 lines · c
1//===--- Time units conversion ----------------------------------*- C++ -*-===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_UNITS_H10#define LLVM_LIBC_SRC___SUPPORT_TIME_UNITS_H11 12#include "hdr/types/time_t.h"13#include "src/__support/common.h"14#include "src/__support/macros/config.h"15 16namespace LIBC_NAMESPACE_DECL {17namespace time_units {18LIBC_INLINE constexpr time_t operator""_s_ns(unsigned long long s) {19  return static_cast<time_t>(s * 1'000'000'000);20}21LIBC_INLINE constexpr time_t operator""_s_us(unsigned long long s) {22  return static_cast<time_t>(s * 1'000'000);23}24LIBC_INLINE constexpr time_t operator""_s_ms(unsigned long long s) {25  return static_cast<time_t>(s * 1'000);26}27LIBC_INLINE constexpr time_t operator""_ms_ns(unsigned long long ms) {28  return static_cast<time_t>(ms * 1'000'000);29}30LIBC_INLINE constexpr time_t operator""_ms_us(unsigned long long ms) {31  return static_cast<time_t>(ms * 1'000);32}33LIBC_INLINE constexpr time_t operator""_us_ns(unsigned long long us) {34  return static_cast<time_t>(us * 1'000);35}36} // namespace time_units37} // namespace LIBC_NAMESPACE_DECL38 39#endif // LLVM_LIBC_SRC___SUPPORT_TIME_UNITS_H40