You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by sh...@e-z.net on 2012/04/19 18:08:07 UTC

Date-Time Computations

Date-Time Computations

I have systems where native 64bit integers are not available.

The 64bit data storage is a structure containing a 32-bit-high
and 32-bit-low integers.

I would like to implement 64bit values on 32bit platforms.  The
pressing need is to provide a Joda-Time or JDK date-time capability
in C/C++ for XPath libraries written in C++.  Calendar operations
are currently a big frustration on 32bit platforms.

Can such a 32bit composite structure be mapped and used as the
data for a 64bit microsecond clock value?

Are there arithmetic functions available that can simulate 64bit
arithmetic on the composite structure when native 64bit is not
available to the platform?

Integer arithmetic operation functions (Add, Subtract, Multiply,
Divide, Remainder, Modulo) should be capable of operating on
such composite values.  The native 64bit operations should be
used if available to the platform.  The simulated operations
should be used if 64bit integers are actually a composite
structure of two 32bit values.

Sincerely,
Steven J. Hathaway




Re: Date-Time Computations

Posted by sh...@e-z.net.
> Date-Time Computations
>
> I have systems where native 64bit integers are not available.
>
> The 64bit data storage is a structure containing a 32-bit-high
> and 32-bit-low integers.
>
> I would like to implement 64bit values on 32bit platforms.  The
> pressing need is to provide a Joda-Time or JDK date-time capability
> in C/C++ for XPath libraries written in C++.  Calendar operations
> are currently a big frustration on 32bit platforms.
>
> Can such a 32bit composite structure be mapped and used as the
> data for a 64bit microsecond clock value?
>
> Are there arithmetic functions available that can simulate 64bit
> arithmetic on the composite structure when native 64bit is not
> available to the platform?
>
> Integer arithmetic operation functions (Add, Subtract, Multiply,
> Divide, Remainder, Modulo) should be capable of operating on
> such composite values.  The native 64bit operations should be
> used if available to the platform.  The simulated operations
> should be used if 64bit integers are actually a composite
> structure of two 32bit values.
>
> Sincerely,
> Steven J. Hathaway
>

More information on aribitrary-precision integer arithmetic
is available at the GNU MP project (The GNU Multiple Precision
Arithmetic Library).  This is a multiple-precision library
written in C for arbitrary precision arithmetic on integers,
rational numbers, and floating-point numbers.

For up-to-date information on GMP, see the web pages at:

   http://gmplib.org

I have not tried to create a Microsoft Visual Studio build
for GMP.  The current build platforms use the GNU make library.

Sincerely,
Steven J. Hathaway



Re: Date-Time Computations

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 4/19/2012 11:08 AM, shathawa@e-z.net wrote:
> 
> I have systems where native 64bit integers are not available.

Surely your c tooling has 64 bit emulation already?  If you are
really reimplementing 64 bit math you are in for a world of hurt,
and won't be nearly as efficient or defect free as if you let the
toolchain take care of it for you.

Simply, apr requires 64 bit int types, even if emulated and not
native.  Anything else is going to be a pretty major hack.