tags:

views:

82

answers:

3

How can I print only the current time (not the date) to a file? I need it in this format...

13:55:36

I've tried a few different ideas but they all include the date too.

+1  A: 

Try strftime()

Michael Krelin - hacker
+2  A: 

Try perusing this ctime reference

A combination of using time(), localtime(), strftime(), and the struct tm should get you there

Graphics Noob
+1  A: 

Use strftime! There is a code example on that page showing how to prepare for use of this function using time(), localtime()...

char timestring[12];
strftime(timestring,sizeof(timestring),"%T",timestruct);
puts(timestring);
KernelJ