2014-10-08 11:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbamf/amfdec.c
    ! simplified and fixed datetime decoding.
      Please verify what is the correct time base value.
         Used by current and commented previous wrong code:
            1970-01-01 00:00:00 => 210866803200000
         or:
            1969/12/31 12:00:00 => 210866760000000
      Testing please remember about UTC offset.

  * contrib/hbbz2/core.c
    ! fixed declaration for bz_internal_error()
This commit is contained in:
Przemysław Czerpak
2014-10-08 11:06:20 +02:00
parent 65dcec9da3
commit 02e9546d90
3 changed files with 22 additions and 12 deletions

View File

@@ -10,6 +10,19 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-10-08 11:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbamf/amfdec.c
! simplified and fixed datetime decoding.
Please verify what is the correct time base value.
Used by current and commented previous wrong code:
1970-01-01 00:00:00 => 210866803200000
or:
1969/12/31 12:00:00 => 210866760000000
Testing please remember about UTC offset.
* contrib/hbbz2/core.c
! fixed declaration for bz_internal_error()
2014-10-08 02:46 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbdefs.h
* minor fix in recently added casting

View File

@@ -477,22 +477,12 @@ static HB_BOOL amf3_deserialize_array( amfContext * context, PHB_ITEM pItem, HB_
/* Decode a date. */
static HB_BOOL amf3_decode_epoch( amfContext * context, PHB_ITEM pItem )
{
double dJulian, dTime;
double epoch_millisecs;
double * epoch_p = &epoch_millisecs;
if( ! amfX_decode_double( context, epoch_p ) )
if( ! amfX_decode_double( context, &epoch_millisecs ) )
return HB_FALSE;
/* 210866760000000 unix_epoch milliseconds base in JD */
dTime = modf( ( 210866760000000 + epoch_millisecs + 0.5 ) / HB_MILLISECS_PER_DAY, &dJulian );
hb_itemPutTDT( pItem, ( long ) dJulian, ( long ) ( dTime * HB_MILLISECS_PER_DAY ) );
/* TOFIX: why following Harbour function doesn't work out of the box?
C compiler was MSVC 7.1 (Visual Studio 2003)
hb_itemPutTD( pItem, epoch_millisecs + 210866803200000 );
*/
hb_itemPutTD( pItem, ( epoch_millisecs + 210866803200000.4 ) / HB_MILLISECS_PER_DAY );
return HB_TRUE;
}

View File

@@ -56,6 +56,13 @@
#include "hbbz2.ch"
/* Required if bz2 lib was built with BZ_NO_STDIO [vszakats] */
#ifdef __cplusplus
extern "C" {
#endif
extern void bz_internal_error ( int errcode );
#ifdef __cplusplus
}
#endif
void bz_internal_error( int errcode )
{
hb_errInternal( ( HB_ERRCODE ) errcode, "libbzip2", NULL, NULL );