opcua_time.c 451 B

123456789101112131415161718192021222324252627
  1. /*
  2. * opcua_time.c
  3. *
  4. * Created on: Feb 5, 2014
  5. * Author: opcua
  6. */
  7. #include "opcua_builtInDatatypes.h"
  8. #include "opcua_advancedDatatypes.h"
  9. #include <time.h>
  10. #include <assert.h>
  11. #include <errno.h>
  12. #include <stdarg.h>
  13. //get the current Server Time
  14. UA_DateTime opcua_time_now()
  15. {
  16. Int64 time1970 = 621356004000000000;
  17. time_t now = time(NULL);
  18. Int64 now_nano_ticks = ((Int64)now) * 10 * 1000 * 1000;
  19. return now_nano_ticks + time1970;
  20. }