cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/17/06:03:19

From: Myron Seto <myron_seto AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp,alt.comp.lang.learn.c-c++,comp.lang.c
Subject: Question(newbie): strptime alternative
Date: Wed, 17 Nov 1999 08:29:40 GMT
Organization: Deja.com - Before you buy.
Lines: 20
Message-ID: <80tp1j$f56$1@nnrp1.deja.com>
NNTP-Posting-Host: 194.38.93.1
X-Article-Creation-Date: Wed Nov 17 08:29:40 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: 1.0 SICPASERVER05, 1.0 x25.deja.com:80 (Squid/1.1.22) for client 194.38.93.1
X-MyDeja-Info: XMYDJUIDmyron_seto
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Networld,
Here's an easy question, for a usually non programmer.  I wish to write
a simple C program to calculate the number of days between two dates.
Normally, I would use strptime

#include <time.h>
const long secondsperday = (24 * 60 * 60);
struct tm first, second;
strptime("10/1/1972", "%x", &first)
strptime("12/10/1999", "%x", &second)
printf("%d\n", (mktime(&second) - mktime(&first)) / secondsperday);

for example, but djgpp compiler does not have strptime.  Can someone
please suggest an alternative?  Exactly if possible.
Thanks!
Myron Seto


Sent via Deja.com http://www.deja.com/
Before you buy.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019