Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libc/include/llvm-libc-macros/baremetal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_header(
time_macros
HDR
time-macros.h
)
24 changes: 24 additions & 0 deletions libc/include/llvm-libc-macros/baremetal/time-macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===-- Definition of macros from time.h ---------------------------------===//
//
// 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 LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H
#define LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H

#ifdef __CLK_TCK
#define CLOCKS_PER_SEC __CLK_TCK
#else
#if defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || \
defined(__arm64__) || defined(_M_ARM64)
// Semihosting uses centiseconds as default
#define CLOCKS_PER_SEC 100
#else
#define CLOCKS_PER_SEC 1000000
#endif
#endif

#endif // LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H
7 changes: 1 addition & 6 deletions libc/include/llvm-libc-macros/time-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@
#include "gpu/time-macros.h"
#elif defined(__linux__)
#include "linux/time-macros.h"
#elif defined(__arm__) || defined(_M_ARM) || defined(__aarch64__)
#ifdef __CLK_TCK
#define CLOCKS_PER_SEC __CLK_TCK
#else
// Semihosting uses centiseconds as default
#define CLOCKS_PER_SEC 100
#endif
#include "baremetal/time-macros.h"
#endif

#define CLK_TCK CLOCKS_PER_SEC
Expand Down
Loading