1*b8daa45aSPetr Hosek //===-- Implementation of timespec_get for baremetal ----------------------===// 2*b8daa45aSPetr Hosek // 3*b8daa45aSPetr Hosek // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*b8daa45aSPetr Hosek // See https://llvm.org/LICENSE.txt for license information. 5*b8daa45aSPetr Hosek // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*b8daa45aSPetr Hosek // 7*b8daa45aSPetr Hosek //===----------------------------------------------------------------------===// 8*b8daa45aSPetr Hosek 9*b8daa45aSPetr Hosek #include "src/time/timespec_get.h" 10*b8daa45aSPetr Hosek #include "hdr/time_macros.h" 11*b8daa45aSPetr Hosek #include "src/__support/common.h" 12*b8daa45aSPetr Hosek #include "src/__support/macros/config.h" 13*b8daa45aSPetr Hosek 14*b8daa45aSPetr Hosek namespace LIBC_NAMESPACE_DECL { 15*b8daa45aSPetr Hosek 16*b8daa45aSPetr Hosek extern "C" bool __llvm_libc_timespec_get_utc(struct timespec *ts); 17*b8daa45aSPetr Hosek 18*b8daa45aSPetr Hosek LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec * ts, int base)) { 19*b8daa45aSPetr Hosek if (base != TIME_UTC) 20*b8daa45aSPetr Hosek return 0; 21*b8daa45aSPetr Hosek 22*b8daa45aSPetr Hosek if (!__llvm_libc_timespec_get_utc(ts)) 23*b8daa45aSPetr Hosek return 0; 24*b8daa45aSPetr Hosek return base; 25*b8daa45aSPetr Hosek } 26*b8daa45aSPetr Hosek 27*b8daa45aSPetr Hosek } // namespace LIBC_NAMESPACE_DECL 28