delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/06/15/21:26:13

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
Date: Tue, 15 Jun 1999 20:28:27 -0500 (CDT)
From: "Alfredo Ceballos R. " <al708613 AT academ01 DOT ccm DOT itesm DOT mx>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Problems with date algorithm
Message-ID: <Pine.A32.3.95.990615195956.67140A-100000@academ01.ccm.itesm.mx>
MIME-Version: 1.0

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.

Alfredo I. Ceballos Rodriguez
al708613 AT academ01 DOT ccm DOT itesm DOT mx



--
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