LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI. TIMER

I need a function (I do not know if it already exists) for to convert seconds in hh mm ss. I have a callback in Timer and a variable that counts the seconds. I would like to display in format hh/mm/ss.Is it possible? Thank you.
0 Kudos
Message 1 of 3
(2,681 Views)
In message <506500000008000000498A0000-1042324653000@exchange.ni.com>,
Saretta writes
>I need a function (I do not know if it already exists) for to convert
>seconds in hh mm ss. I have a callback in Timer and a variable that
>counts the seconds. I would like to display in format hh/mm/ss.Is it
>possible? Thank you.

void try(void)
{
int hours, mins, secs, timer_value;
char time_string[20];

timer_value = 123456;

hours = timer_value / 3600;
mins = (timer_value % 3600) / 60;
secs = (timer_value % 3600) % 60;

sprintf ( time_string, "%02d/%02d/%02d", hours, mins, secs);

}

--
Regards,

John Cameron.
Electronic & Software Design.
OB5 Ltd. Registered in England & Wales 4633860.
Registered Office: Lowther House Lowther Street Kendal Cumbria
LA9 4DX.
Tel: +44 (0) 1539 734238 Fax: +44 (0) 1539 738064 Mobile: +44 (0) 781 462 8633
Message 2 of 3
(2,681 Views)
Thank you very much. I solved my problem and excuse me for my delay but I had connection problem.
0 Kudos
Message 3 of 3
(2,681 Views)