The difftime function computes the difference between two calendar times: time1 - time0 as per as per 7.27.2.2 section in http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2478.pdf. double difftime(time_t time1, time_t time0); Tested: Unit tests Co-authored-by: Jeff Bailey <jeffbailey@google.com> Reviewed By: jeffbailey Differential Revision: https://reviews.llvm.org/D136631
19 lines
588 B
C++
19 lines
588 B
C++
//===-- Implementation of difftime function -------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "src/time/difftime.h"
|
|
#include "src/__support/common.h"
|
|
|
|
namespace __llvm_libc {
|
|
|
|
LLVM_LIBC_FUNCTION(double, difftime, (time_t end, time_t beginning)) {
|
|
return end - beginning;
|
|
}
|
|
|
|
} // namespace __llvm_libc
|