| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Division by time?! |
EC> using the 'time' structure I have tried to add 59 seconds
EC> onto 2 seconds and get 61 seconds but how do I push the
EC> 60 second bit into the minutes to leave the 1 second bit
EC> in the seconds?
You need a function to adjust the data.
You could write one easily, or you could convert the struct
to a time_t variable using the standard function mktime(),
add the seconds to that, and convert the time_t variable to
a struct tm using the standard localtime() function.
struct tm *adjust_time(struct tm *T, int seconds)
{
time_t as_t = mktime(T) + seconds;
return localtime(as_t);
}
Notice then, that this will work as well for negative values
for seconds as it will for positive values. This will allow
you to subtract seconds or add them according to your needs.
> ] * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 810 639/252 SEEN-BY: 670/218 @PATH: 154/750 222 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.