|
@@ -9,20 +9,16 @@
|
|
*/
|
|
*/
|
|
#include "opcua_builtInDatatypes.h"
|
|
#include "opcua_builtInDatatypes.h"
|
|
#include "opcua_advancedDatatypes.h"
|
|
#include "opcua_advancedDatatypes.h"
|
|
-#include <time.h>
|
|
|
|
-#include <assert.h>
|
|
|
|
-#include <errno.h>
|
|
|
|
-#include <stdarg.h>
|
|
|
|
|
|
+#include <sys/time.h>
|
|
|
|
|
|
-// number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC
|
|
|
|
|
|
+// Number of seconds from 1 Jan. 1601 00:00 to 1 Jan 1970 00:00 UTC
|
|
#define FILETIME_UNIXTIME_BIAS_SEC 11644473600LL
|
|
#define FILETIME_UNIXTIME_BIAS_SEC 11644473600LL
|
|
-//
|
|
|
|
|
|
+// Factors
|
|
#define HUNDRED_NANOSEC_PER_USEC 10LL
|
|
#define HUNDRED_NANOSEC_PER_USEC 10LL
|
|
#define HUNDRED_NANOSEC_PER_SEC (HUNDRED_NANOSEC_PER_USEC * 1000000LL)
|
|
#define HUNDRED_NANOSEC_PER_SEC (HUNDRED_NANOSEC_PER_USEC * 1000000LL)
|
|
|
|
|
|
// IEC 62541-6 §5.2.2.5 A DateTime value shall be encoded as a 64-bit signed integer
|
|
// IEC 62541-6 §5.2.2.5 A DateTime value shall be encoded as a 64-bit signed integer
|
|
// which represents the number of 100 nanosecond intervals since January 1, 1601 (UTC).
|
|
// which represents the number of 100 nanosecond intervals since January 1, 1601 (UTC).
|
|
-
|
|
|
|
UA_DateTime opcua_getTime() {
|
|
UA_DateTime opcua_getTime() {
|
|
UA_DateTime dateTime;
|
|
UA_DateTime dateTime;
|
|
struct timeval tv;
|
|
struct timeval tv;
|
|
@@ -31,4 +27,3 @@ UA_DateTime opcua_getTime() {
|
|
* HUNDRED_NANOSEC_PER_SEC + tv.tv_usec * HUNDRED_NANOSEC_PER_USEC;
|
|
* HUNDRED_NANOSEC_PER_SEC + tv.tv_usec * HUNDRED_NANOSEC_PER_USEC;
|
|
return dateTime;
|
|
return dateTime;
|
|
}
|
|
}
|
|
-
|
|
|