public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problems with date algorithm
@ 1999-06-15 18:25 Alfredo Ceballos R. 
  1999-06-15 21:41 ` Mumit Khan
  1999-06-30 22:10 ` Alfredo Ceballos R. 
  0 siblings, 2 replies; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-15 18:25 UTC (permalink / raw)
  To: cygwin

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@academ01.ccm.itesm.mx



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-15 18:25 Problems with date algorithm Alfredo Ceballos R. 
@ 1999-06-15 21:41 ` Mumit Khan
  1999-06-16 12:56   ` Alfredo Ceballos R. 
  1999-06-30 22:10   ` Mumit Khan
  1999-06-30 22:10 ` Alfredo Ceballos R. 
  1 sibling, 2 replies; 10+ messages in thread
From: Mumit Khan @ 1999-06-15 21:41 UTC (permalink / raw)
  To: Alfredo Ceballos R. ; +Cc: cygwin

"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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-15 21:41 ` Mumit Khan
@ 1999-06-16 12:56   ` Alfredo Ceballos R. 
  1999-06-16 13:06     ` Alfredo Ceballos R. 
                       ` (2 more replies)
  1999-06-30 22:10   ` Mumit Khan
  1 sibling, 3 replies; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-16 12:56 UTC (permalink / raw)
  To: Mumit Khan; +Cc: cygwin

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Problems with date algorithm
  1999-06-16 12:56   ` Alfredo Ceballos R. 
@ 1999-06-16 13:06     ` Alfredo Ceballos R. 
  1999-06-30 22:10       ` Alfredo Ceballos R. 
  1999-06-19 16:39     ` Mumit Khan
  1999-06-30 22:10     ` Alfredo Ceballos R. 
  2 siblings, 1 reply; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-16 13:06 UTC (permalink / raw)
  To: Mumit Khan; +Cc: cygwin

 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-16 12:56   ` Alfredo Ceballos R. 
  1999-06-16 13:06     ` Alfredo Ceballos R. 
@ 1999-06-19 16:39     ` Mumit Khan
  1999-06-30 22:10       ` Mumit Khan
  1999-06-30 22:10     ` Alfredo Ceballos R. 
  2 siblings, 1 reply; 10+ messages in thread
From: Mumit Khan @ 1999-06-19 16:39 UTC (permalink / raw)
  To: Alfredo Ceballos R. ; +Cc: cygwin

On Wed, 16 Jun 1999, Alfredo Ceballos R.  wrote:

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

Perhaps you can ask Anders for help if you can't get the new w32api
package to install.

As for int64ShlMod2, it complains because it doesn't exist. 

> Could you please be more explicit in the description of the shifting
> method you have mentioned. Thank You.

Let's say you have a LARGE_INTEGER and you now want to convert that to a 
64-bit integer (GCC supports ``long long'', equivalent to MSVC's __int64).
  
  LARGE_INTEGER li;
  unsigned long long l;

  /* fill up li with whatever. */

  l = ((unsigned long long) li.HighPart << 32) + ((unsigned) li.LowPart);

Regards,
Mumit



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-15 21:41 ` Mumit Khan
  1999-06-16 12:56   ` Alfredo Ceballos R. 
@ 1999-06-30 22:10   ` Mumit Khan
  1 sibling, 0 replies; 10+ messages in thread
From: Mumit Khan @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Alfredo Ceballos R. ; +Cc: cygwin

"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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Problems with date algorithm
  1999-06-16 13:06     ` Alfredo Ceballos R. 
@ 1999-06-30 22:10       ` Alfredo Ceballos R. 
  0 siblings, 0 replies; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Mumit Khan; +Cc: cygwin

 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-19 16:39     ` Mumit Khan
@ 1999-06-30 22:10       ` Mumit Khan
  0 siblings, 0 replies; 10+ messages in thread
From: Mumit Khan @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Alfredo Ceballos R. ; +Cc: cygwin

On Wed, 16 Jun 1999, Alfredo Ceballos R.  wrote:

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

Perhaps you can ask Anders for help if you can't get the new w32api
package to install.

As for int64ShlMod2, it complains because it doesn't exist. 

> Could you please be more explicit in the description of the shifting
> method you have mentioned. Thank You.

Let's say you have a LARGE_INTEGER and you now want to convert that to a 
64-bit integer (GCC supports ``long long'', equivalent to MSVC's __int64).
  
  LARGE_INTEGER li;
  unsigned long long l;

  /* fill up li with whatever. */

  l = ((unsigned long long) li.HighPart << 32) + ((unsigned) li.LowPart);

Regards,
Mumit



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Problems with date algorithm
  1999-06-15 18:25 Problems with date algorithm Alfredo Ceballos R. 
  1999-06-15 21:41 ` Mumit Khan
@ 1999-06-30 22:10 ` Alfredo Ceballos R. 
  1 sibling, 0 replies; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-30 22:10 UTC (permalink / raw)
  To: cygwin

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@academ01.ccm.itesm.mx



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problems with date algorithm
  1999-06-16 12:56   ` Alfredo Ceballos R. 
  1999-06-16 13:06     ` Alfredo Ceballos R. 
  1999-06-19 16:39     ` Mumit Khan
@ 1999-06-30 22:10     ` Alfredo Ceballos R. 
  2 siblings, 0 replies; 10+ messages in thread
From: Alfredo Ceballos R.  @ 1999-06-30 22:10 UTC (permalink / raw)
  To: Mumit Khan; +Cc: cygwin

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-06-30 22:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-15 18:25 Problems with date algorithm Alfredo Ceballos R. 
1999-06-15 21:41 ` Mumit Khan
1999-06-16 12:56   ` Alfredo Ceballos R. 
1999-06-16 13:06     ` Alfredo Ceballos R. 
1999-06-30 22:10       ` Alfredo Ceballos R. 
1999-06-19 16:39     ` Mumit Khan
1999-06-30 22:10       ` Mumit Khan
1999-06-30 22:10     ` Alfredo Ceballos R. 
1999-06-30 22:10   ` Mumit Khan
1999-06-30 22:10 ` Alfredo Ceballos R. 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).