using a simple code
struct tm nsr;
struct tm ssr ;
nsr.tm_hour = 6; nsr.tm_min = 8; nsr.tm_sec = 46 ;
nsr.tm_mday = 29 ; nsr.tm_mon = 2; nsr.tm_year = 2024; ;
mktime(&nsr);
ssr = nsr ;
ssr.tm_sec +=186600 ;
mktime(&ssr);
printf ( “%02d:%02d:%02dn”, ssr.tm_hour, ssr.tm_min, ssr.tm_sec);
printf ( “%02d:%02d:%02dn”, ssr.tm_mday, ssr.tm_mon, ssr.tm_year);
OUTPUTS
09:58:46
31:02:2024
what could be wrong here. If add lesser value to tm_sec , with the date, it gives correct time.
shouln’t the date roll over to march correctly ?
Suresh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.