delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/06/16/01:41:17

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199906160334.WAA20801@mercury.xraylith.wisc.edu>
To: "Alfredo Ceballos R. " <al708613 AT academ01 DOT ccm DOT itesm DOT mx>
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Problems with date algorithm
In-Reply-To: Your message of "Tue, 15 Jun 1999 20:28:27 CDT."
<Pine DOT A32 DOT 3 DOT 95 DOT 990615195956 DOT 67140A-100000 AT academ01 DOT ccm DOT itesm DOT mx>
Date: Tue, 15 Jun 1999 22:34:17 -0500
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

"Alfredo Ceballos R. " <al708613 AT academ01 DOT ccm DOT itesm DOT mx> writes:
> Hi everybody, I've a problem with an algorithm that calculates an interval
> of time (days) after the current date, I use the function
> GetSystemTime(&st), in this form the current date is stored in the
> SYSTEMTIME st structure, but if I add some days to the structure member
> the format is not conserved so the information in the structure must be
> passed to a FILETIME ft structure with the SystemTimeToFileTime(&st, &ft)
> function, in this form the information in the SYSTEMTIME structure is
> passed to two members that are DWORD each, if this info is passed again to
> a LARGE_INTEGER li structure, in the lcc-win32 compiler the definition of
> this structure includes a member called QuadPart, in that way normal 64
> bits arithmetic can be used to add the time elapsed, and passing the
> LowPart and HighPart of the LARGE_INTEGER members to the corresponding
> members in the FILETIME and then converting this info to SYSTEMTIME with
> the function FileTimeToSystemTime(&ft, &st), the work is done; but when i
> try to compile the code with mingw32, it says that in LARGE_INTEGER
> doesn't exist a member called QuadPart. All this story leads me to this
> question, exist a form in which I can make some arithmetic operations if
> I've the current time in tow DoubleWords and the other operand is larger
> (64 bits) because to add 6 days to the current time this must be expresed
> in 100 nanosecond so ((6 days)*(24 hours)*(60 minutes)*(60
> seconds)*(1000000000 miliseconds))/100 is the number that must be added to
> the LARGE_INTEGER members LowPart and HighPart, but how can I split
> correctly the number I want to add in order to make the sum in tow parts.
> As I've mentioned, this work can be done in lcc-win32 with ease in some
> way like li.QuadPart=li.QuadPart+cont, with li as the LARGE_INTEGER nad
> cont as the number to add, but in mingw32 how can I do that. I'll be very
> grateful if you can help me, if not anyway Thank You for your time.

Your observation is correct that the current headers don't have a QuadPart
in LARGET_INTEGER.

Good news is that the windows32api headers (the ones we use currently) are
being replaced by w32api headers by Anders Norlander that do support it
correctly. You can get his snapshot and use those instead. See:

  http://www.acc.umu.se/~anorland/gnu-win32/

Bad news is that the current headers don't support it and you have to use
bit shifting with HighPart and LowPart to do the right thing.

Regards,
Mumit



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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