Sina.Sattari Posted August 17, 2009 Share Posted August 17, 2009 The Sys.Time is accessible through the terminal and script programs, but not through the C programs and neither through the shared memory structure. How can a user get the same response in the C programs? Well you can access the same data by doing the same calculations that the PMAC does when Sys.Time is queried: [code] #include #include #include "../../Include/pp_proj.h" int main(void) { int counter; SHM *pSHM; // defining a pointer to the shared memroy location // using this pointer you can access most of the structures InitLibrary(); // Initializing the Library pSHM = GetSharedMemPtr(); //Initializing the pointer to the shared memory for( counter=0; counter<10; counter++) { // How to get Sys.Time in the C programs // Whenever the Sys.Time is called in the GPASCII, the following calculation is done // fclock() system function will return an unsigned 64 bit integer value representing the time passed since last $$$ or power-up // the ClockSF will convert the output of fclock() to microseconds // the 1e-6 will convert it to seconds printf("%f\n",1e-6*pSHM->ClockSF*u64btod(fclock())); usleep(1000000); } CloseLibrary(); return 0; } [/code] Link to comment Share on other sites More sharing options...
bradp Posted February 16, 2010 Share Posted February 16, 2010 In firmware 1.0.0.148 and newer the function double GetCPUClock(); can be used in place of this code. It returns the fclock in units of usec. Link to comment Share on other sites More sharing options...
Recommended Posts