This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problems with date algorithm


 
> On Tue, 15 Jun 1999, Mumit Khan wrote:
> 
> > "Alfredo Ceballos R. " <al708613@academ01.ccm.itesm.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@sourceware.cygnus.com
 
 
Thank You for your answer but I'm using mingw32 and I've already tried the
new API definitions that you have mentioned but when I use the make file
included in the distribution, it doesn't work. On the other hand, i was
trying to use the function int64ShllMod2(), but the compiler says that is
an unknown function, I also try to use a logical operation with a mask to
split the 64 number and add it propertly but the compiler says that this
kind of operations only must be done with integers.
 
Could you please be more explicit in the description of the shifting
method you have mentioned. Thank You. 


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]