749 |
static int min= 60; |
static int min= 60; |
750 |
static int hour= 3600; |
static int hour= 3600; |
751 |
static int day= 86400; |
static int day= 86400; |
752 |
long rest; |
long rest_d; |
753 |
|
long rest_h; |
754 |
|
long rest_m; |
755 |
char buf[STRLEN]; |
char buf[STRLEN]; |
756 |
char *p= buf; |
char *p= buf; |
757 |
|
|
758 |
*buf= 0; |
*buf= 0; |
759 |
|
|
760 |
if((rest= delta/day)>0) { |
if((rest_d= delta/day)>0) { |
761 |
p+= sprintf(p, "%ldd ", rest); |
p+= sprintf(p, "%ldd ", rest_d); |
762 |
delta-= rest*day; |
delta-= rest_d*day; |
763 |
} |
} |
764 |
if((rest= delta/hour)>0) { |
if((rest_h= delta/hour)>0 || ( rest_d > 0 )) { |
765 |
p+= sprintf(p, "%ldh ", rest); |
p+= sprintf(p, "%ldh ", rest_h); |
766 |
delta-= rest*hour; |
delta-= rest_h*hour; |
|
} |
|
|
if((rest= delta/min)>0) { |
|
|
p+= sprintf(p, "%ldm ", rest); |
|
|
delta-= rest*min; |
|
767 |
} |
} |
768 |
|
|
769 |
|
rest_m= delta/min; |
770 |
|
p+= sprintf(p, "%ldm ", rest_m); |
771 |
|
delta-= rest_m*min; |
772 |
|
|
773 |
return xstrdup(buf); |
return xstrdup(buf); |
774 |
|
|