Feature/refactor datetime os dependency (#63)

* remove dependency on OS for time functions.

* add datetime epoch to and from seconds (yikes! 64-bit!). Add symmetric midnight seconds for unit test. Add unit tests.

* clean up BACnet date time warnings

* fix BACnet datetime warnings

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2020-04-04 11:23:26 -05:00
committed by GitHub
parent b159402647
commit 0ce6368b43
7 changed files with 142 additions and 108 deletions
+2 -8
View File
@@ -29,12 +29,12 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h> /* for memmove */
#include <time.h> /* for timezone, localtime */
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacenum.h"
#include "bacnet/bacapp.h"
#include "bacnet/config.h" /* the custom stuff */
#include "bacnet/datetime.h"
#include "bacnet/apdu.h"
#include "bacnet/wp.h" /* WriteProperty handling */
#include "bacnet/rp.h" /* ReadProperty handling */
@@ -79,12 +79,6 @@
#include "bacnet/basic/ucix/ucix.h"
#endif /* defined(BAC_UCI) */
#if defined(__BORLANDC__) || defined(_WIN32)
/* Not included in time.h as specified by The Open Group */
/* Difference from UTC and local standard time */
long int timezone;
#endif
/* local forward (semi-private) and external prototypes */
int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata);
bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data);
@@ -1838,7 +1832,7 @@ void Device_Init(object_functions_t *object_table)
}
ucix_cleanup(ctx);
#endif /* defined(BAC_UCI) */
datetime_init();
if (object_table) {
Object_Table = object_table;
} else {