🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14008

Re: comparing Dates

#14008
From: Bob Gonder
Date: Thu, 04 Sep 2003 14:59
25 lines
2134 bytes
Luiz Rafael Culik Guimaraes wrote:

>What is the best way to get the smallest date between two SYSTEMTIME values

What do you mean the "smallest date"?  You can get the difference by
converting to 64bit integers and subtracting (As the SYSTEMTIME help
suggests)  Ah, the word "between" threw me: "get the smallest of two"

Help:
It is not recommended that you add and subtract values from the
SYSTEMTIME structure to obtain relative times. Instead, you should 
�	Convert the SYSTEMTIME structure to a FILETIME structure.
�	Copy the resulting FILETIME structure to a LARGE_INTEGER
structure.
�	Use normal 64-bit arithmetic on the LARGE_INTEGER value.

So, put the above into a function
   LARGE_INTEGER  SysTime2Int64( *SYSTEMTIME );

Then you can do whatever you want.
	if( SysTime2Int64(&First) > SysTime2Int64(&Second) )
	{	// Second is smaller
	}else{
		//First is smaller or equal
	};
Technical Details
Message-ID: <asjelv8fq5h0jkedp42auupaqs62b3c3jd@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!diablo.voicenet.com!prodigy.com!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f574a3e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,7bb8b0b789f7aaae
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-04 08:00:45 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: comparing Dates
Date: Thu, 04 Sep 2003 07:59:05 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <asjelv8fq5h0jkedp42auupaqs62b3c3jd@4ax.com>
References: <3f574a3e$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 67.31.164.67
X-Trace: newsgroups.borland.com 1062687545 67.31.164.67 (4 Sep 2003 07:59:05 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!diablo.voicenet.com!prodigy.com!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail