cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
7,707 Views
Registered: ‎04-21-2008

Time Stamp PPC

Jump to solution

Hi everyone,

 

Is it possible to get the calendar time from the PPC? I need to generate a time stamp, and I was trying to use the standard c library <time.h>. I'm using the standard approach like

 

time_t now;
struct tm  *ts;
char       buf[80];

 

time(&now);
ts = localtime(&now);
strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
xil_printf("%s\n", buf);

 

but I got an error saying that the function "time" is not defined. However, the other functions (localtime and strftime) works OK. Is the function "time" implemented in EDK?
Is there another way to do the same?

 

Thanks a lot in advance 

Message Edited by sistdig on 08-19-2008 10:30 AM
0 Kudos
Reply
1 Solution

Accepted Solutions
Observer
Observer
9,080 Views
Registered: ‎08-02-2007
In order for a time function to work it needs a time reference. The time function will not work in a fpga design because there is no time reference available.

Instead, you could use the xps_timer or the internal PPC PIT timers. This can be used to calculate execution time for the sw application. in regards to a time stamp, this information cannot be hard stored in the PPC when the device is powered off because this functionality is not included in Xilinx FPGA's.

View solution in original post

0 Kudos
Reply
5 Replies
Observer
Observer
9,081 Views
Registered: ‎08-02-2007
In order for a time function to work it needs a time reference. The time function will not work in a fpga design because there is no time reference available.

Instead, you could use the xps_timer or the internal PPC PIT timers. This can be used to calculate execution time for the sw application. in regards to a time stamp, this information cannot be hard stored in the PPC when the device is powered off because this functionality is not included in Xilinx FPGA's.

View solution in original post

0 Kudos
Reply
Visitor
Visitor
7,679 Views
Registered: ‎04-21-2008

Thanks for your answer.

 

It's my first application in embedded systems, and it's a little hard to get used to the new limitations when you have just programmed on an desktop machine :).

 

So, I'll need to think in another equivalent way. 

0 Kudos
Reply
Xilinx Employee
Xilinx Employee
7,668 Views
Registered: ‎07-31-2008

If you just need a timestamp you can use the functions in xtime_l.h, for example:

 

XTime tstamp; 

XTime_GetTime(&tstamp);

 

XTime_GetTime() returns a 64 bit value in tstamp. The value is read from the PPC internal time base register pair which is incremented with every processor cycle.

 

0 Kudos
Reply
Historian
Historian
7,650 Views
Registered: ‎02-25-2008

edk_dingle wrote:
In order for a time function to work it needs a time reference. The time function will not work in a fpga design because there is no time reference available.

Instead, you could use the xps_timer or the internal PPC PIT timers. This can be used to calculate execution time for the sw application. in regards to a time stamp, this information cannot be hard stored in the PPC when the device is powered off because this functionality is not included in Xilinx FPGA's.

You could include a real-time clock chip in your design. Various vendors (ST, Maxim, Epson, do the google) sell these things, and they're cheap, often have a battery backup and they have a simple serial interface that can be connected to the FPGA in the usual fashion.

 

-a

----------------------------Yes, I do this for a living.
0 Kudos
Reply
Visitor
Visitor
7,600 Views
Registered: ‎04-21-2008

Thanks a lot.

I wanted to know if it was possible.  So, I will think in some solution using the timer register.

0 Kudos
Reply