From 15250b2e51e8383a0df4b6e5a870c07e914d406d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 17 Feb 2017 17:17:24 +0000 Subject: Fix: timer.* issues Change-Id: I1c3721403198b3c5525a811bd3c7cbf6b8e78e5b Signed-off-by: Romain Forlot --- src/timer.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/timer.cpp (limited to 'src/timer.cpp') diff --git a/src/timer.cpp b/src/timer.cpp new file mode 100644 index 00000000..70ce2b81 --- /dev/null +++ b/src/timer.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015, 2016 "IoT.bzh" + * Author "Romain Forlot" + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +inline unsigned long systemTimeMs() +{ + struct timeb t_msec; + unsigned long int timestamp_msec; + + if(!::ftime(&t_msec)) + { + timestamp_msec = ((unsigned long int) t_msec.time) * 1000ll + + (unsigned long int) t_msec.millitm; + } + return timestamp_msec; +} \ No newline at end of file -- cgit 1.2.3-korg