Untitled
Guest 141 29th May, 2023
int get_hour (int timestamp)
{
int hour;
hour = (timestamp / (1000 * 60 * 60));
return hour;
}
int get_min (int timestamp)
{
int min;
min = ((timestamp % 3600000) / 60000);
return min;
}
int get_second (int timestamp)
{
int second;
second = (((timestamp % 3600000) % 60000) / 1000);
return second;
}
int main ()
{
long timer_start = 26236262; //get_hal_tick
long cur_time = 26290262;
long ms;
int s = 0, m, h;
printf ("%li \n", cur_time - timer_start);
// while(1)
// {
//cur_time = get_hal_tick
ms = cur_time - timer_start;
if (s != get_second(ms)){
s = get_second(ms);
m = get_min(ms);
h = get_hour(ms);
// printf ("sekundy %li \n", s);
// printf ("minuty %li \n", m);
// printf ("godziny %li \n", m);
printf ("%02d:%02d:%02d \n", h, m, s);
}
To share this paste please copy this url and send to your friends
RAW Paste Data