Use gettimeofday and localtime_r to implement DATE_AND_TIME intrinsic. The Windows version fallbacks to the "no date and time information available" defined by the standard (strings set to blanks and values to -HUGE). The implementation uses an ifdef between windows and the rest because from my tests, the SFINAE approach leads to undeclared name bogus errors with clang 8 that seems to ignore failure to instantiate is not an error for the function names (i.e., it understands it should not instantiate the version using gettimeofday if it is not there, but still yields an error that it is not declared on the spot where it is called in the uninstantiated version). Differential Revision: https://reviews.llvm.org/D108622
24 lines
583 B
C
24 lines
583 B
C
/*
|
|
This test makes sure that flang's runtime does not depend on the C++ runtime
|
|
library. It tries to link this simple file against libFortranRuntime.a with
|
|
a C compiler.
|
|
|
|
REQUIRES: c-compiler
|
|
|
|
RUN: %cc -std=c90 %s -I%runtimeincludes %libruntime %libdecimal -o /dev/null
|
|
*/
|
|
|
|
#include "entry-names.h"
|
|
|
|
/*
|
|
Manually add declarations for the runtime functions that we want to make sure
|
|
we're testing. We can't include any headers directly since they likely contain
|
|
C++ code that would explode here.
|
|
*/
|
|
double RTNAME(CpuTime)();
|
|
|
|
int main() {
|
|
double x = RTNAME(CpuTime)();
|
|
return x;
|
|
}
|