Files
clang-p2996/libc/src/time/difftime.cpp
Raman Tenneti 12204429f2 [libc] Add implementation of difftime function.
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
2022-10-24 15:14:26 -07:00

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