diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index bd2b872c857..760d40b84f4 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2005-09-24 Francois-Xavier Coudert + + PR libfortran/23380 + * intrinsics/cpu_time.c (__cpu_time_1): Provide a MS Windows + version. + 2005-09-14 Jerry DeLisle + +static void +__cpu_time_1 (long *sec, long *usec) +{ + union { + FILETIME ft; + unsigned long long ulltime; + } kernel_time, user_time; + + FILETIME unused1, unused2; + unsigned long long total_time; + + /* No support for Win9x. The high order bit of the DWORD + returned by GetVersion is 0 for NT and higher. */ + if (GetVersion () >= 0x80000000) + { + *sec = -1; + *usec = 0; + return; + } + + /* The FILETIME structs filled in by GetProcessTimes represent + time in 100 nanosecond units. */ + GetProcessTimes (GetCurrentProcess (), &unused1, &unused2, + &kernel_time.ft, &user_time.ft); + + total_time = (kernel_time.ulltime + user_time.ulltime)/10; + *sec = total_time / 1000000; + *usec = total_time % 1000000; +} + +#else + static inline void __cpu_time_1 (long *sec, long *usec) { @@ -110,6 +148,8 @@ __cpu_time_1 (long *sec, long *usec) #endif /* HAVE_GETRUSAGE */ } +#endif + extern void cpu_time_4 (GFC_REAL_4 *); iexport_proto(cpu_time_4);