Help me , ho can covert this code to fortran :
#include <stdio.h> #include <tchar.h> #include <windows.h> #include <omp.h> //--------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern void UseTiming1(); #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ struct Thread_time { double* Thread; }; class Timing { public: Timing(); ~Timing(); void StartTiming(); void StopTiming(); Thread_time GetUserSeconds() const { for (int i = 0; i < nthreads; i++){ time.Thread[i]=double(m_userTime[i])/ 10000000.0; } //delete[] m_userTime; return (time); } private: __int64* GetUserTime() const; __int64* m_userTime; Thread_time time; int nthreads; }; Timing::Timing(){ #pragma omp parallel { nthreads=omp_get_num_threads(); } printf("numbzer thread = %d\n",nthreads); m_userTime=new __int64[nthreads]; time.Thread=new double[nthreads]; } Timing::~Timing(){ delete[] m_userTime; delete[] time.Thread; } __int64* Timing::GetUserTime() const { FILETIME creationTime; FILETIME exitTime; FILETIME kernelTime; FILETIME userTime; __int64 *CurTime; CurTime=new __int64[nthreads]; #pragma omp parallel for private(creationTime,exitTime,kernelTime,userTime) for (int i = 0; i < nthreads; i++){ GetThreadTimes(GetCurrentThread(),&creationTime, &exitTime,&kernelTime, &userTime); CurTime[i] = userTime.dwHighDateTime; CurTime[i] <<= 32; CurTime[i] += userTime.dwLowDateTime; } return CurTime; } void Timing::StartTiming() { m_userTime = GetUserTime(); } void Timing::StopTiming() { //for (int i = 0; i < Number_Thread; i++) __int64 *curUserTime; curUserTime = GetUserTime(); for (int i = 0; i < nthreads; i++){ m_userTime[i] = curUserTime[i] - m_userTime[i]; } } //--------------------------------------------------------- void Calc() { unsigned sum = 0; // #pragma omp parallel for reduction(+:sum) num_threads(2) for (int i = 0; i < 1000000; i++) { char str[1000]; for (int j = 0; j < 999; j++) str[j] = char(((i + j) % 254) + 1); str[999] = 0; for (char c = 'a'; c <= 'z'; c++) if (strchr(str, c) != NULL) sum += 1; } printf("sum = %u\n", sum); } void UseTiming1() { Timing t; t.StartTiming(); Calc(); t.StopTiming(); for (int i = 0; i < 2; i++) printf("Thread %d Timing: %.3G seconds.\n", i,t.GetUserSeconds().Thread[i]); }