MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / SzHMS

Function SzHMS

general.cpp:1902–1921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1900// seconds. For example, 45015 (12*60*60+30*60+15) maps to "+12:30:15"
1901
1902char *SzHMS(int sec)
1903{
1904 static char szHMS[10];
1905 int hr, min;
1906 char ch;
1907
1908 ch = sec >= 0 ? '+' : '-';
1909 sec = NAbs(sec);
1910 hr = sec / 3600;
1911 min = sec / 60 % 60;
1912 sec %= 60;
1913 // Don't display seconds or minutes:seconds if they're zero.
1914 if (!us.fSeconds && min == 0 && sec == 0)
1915 sprintf(szHMS, "%c%d", ch, hr);
1916 else if (!us.fSeconds || sec == 0)
1917 sprintf(szHMS, "%c%d:%02d", ch, hr, min);
1918 else
1919 sprintf(szHMS, "%c%d:%02d:%02d", ch, hr, min, sec);
1920 return szHMS;
1921}
1922
1923
1924// Another string formatter, here return a date string given a month, day, and

Callers 3

DrawInfoFunction · 0.85
FSetDstZonFunction · 0.85
DisplayTimezoneChangesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected