Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions flang-rt/lib/runtime/extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
#include <thread>

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>

#include "flang/Common/windows-include.h"
#include <synchapi.h>

inline void CtimeBuffer(char *buffer, size_t bufsize, const time_t cur_time,
Expand Down Expand Up @@ -309,6 +306,9 @@ void RTNAME(Perror)(const char *str) { perror(str); }
// GNU extension function TIME()
std::int64_t RTNAME(time)() { return time(nullptr); }

// MCLOCK: returns accumulated CPU time in ticks
std::int32_t FORTRAN_PROCEDURE_NAME(mclock)() { return std::clock(); }

// Extension procedures related to I/O

namespace io {
Expand Down
3 changes: 2 additions & 1 deletion flang/docs/Intrinsics.md
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,9 @@ CACHESIZE, EOF, FP_CLASS, INT_PTR_KIND, ISNAN, LOC
MALLOC, FREE
```

### Library subroutine
### Library subroutines and functions
```
ticks = MCLOCK()
CALL BACKTRACE()
CALL FDATE(TIME)
CALL GETLOG(USRNAME)
Expand Down
9 changes: 5 additions & 4 deletions flang/include/flang/Runtime/extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
#ifndef FORTRAN_RUNTIME_EXTENSIONS_H_
#define FORTRAN_RUNTIME_EXTENSIONS_H_

#include "flang/Runtime/entry-names.h"

#define FORTRAN_PROCEDURE_NAME(name) name##_

#include "flang/Runtime/entry-names.h"
#include <cstddef>
#include <cstdint>

#define FORTRAN_PROCEDURE_NAME(name) name##_

#ifdef _WIN32
// UID and GID don't exist on Windows, these exist to avoid errors.
typedef std::uint32_t uid_t;
Expand Down Expand Up @@ -89,5 +87,8 @@ int FORTRAN_PROCEDURE_NAME(ierrno)();
// GNU extension subroutine PERROR(STRING)
void RTNAME(Perror)(const char *str);

// MCLOCK -- returns accumulated time in ticks
int FORTRAN_PROCEDURE_NAME(mclock)();

} // extern "C"
#endif // FORTRAN_RUNTIME_EXTENSIONS_H_