| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Tobruk |
* Original from Michael Stapleton at 3:711/934.33
Hi Paul,
On Dec 09 13:48, 1996, Michael Stapleton of 3:711/934.33 wrote:
PE>> Probably would have been more useful sending me mktime() itself,
MS> time_t mktime(struct tm *ptm)
MS> {
MS> long day;
MS> time_t sec;
MS> day = 365 * (ptm->tm_year - 70) + ptm->tm_yday;
Ok, you can stop laughing now. :) At the very least, I certainly
shouldn't be using tm_yday! ATM I'm using the following code, but I
think I should take your advice & use the PDCLIB (?) routines.
/* M K T I M E */
#include
#include
#include
static long isleap(long year)
{
return (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
}
time_t mktime(struct tm *ptm)
{
long year, mon, day;
time_t sec;
/* Let's make it easy & presume canonical form for starters :) */
year = ptm->tm_year;
day = ptm->tm_mday;
day += 365 * (year - 70);
day += (year - 69) / 4; /* Leap days since 1-Jan-1970 */
mon = ptm->tm_mon;
day += ((3055 * (mon + 3)) / 100) - 92;
if (mon > 1)
day += isleap(year) - 2;
sec = 86400 * day + 3600 * (ptm->tm_hour + !!daylight) +
60 * ptm->tm_min + ptm->tm_sec + timezone;
return sec;
}
/* * * * * * * * * * * * * * */
I've now got Ctrl-Alt keys working in MsgEd now (substituting for
Alt keys) and it's much easier to use.
Michael Stapleton of Graphic Bits
@EOT:
--- Msged/AM 4.00
* Origin: Graphic Bits (3:711/934.33)SEEN-BY: 711/934 712/610 @PATH: 711/934 |
|
| 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™.