summaryrefslogtreecommitdiffstats
path: root/src/timer.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-17 17:17:24 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-20 11:14:55 +0000
commit15250b2e51e8383a0df4b6e5a870c07e914d406d (patch)
tree6c7d0d8c9b41edfacb9749b7694df7c5f8042f98 /src/timer.cpp
parentf97e5f6d0b15df8fe8c7a4621e40c6a23bbac137 (diff)
Fix: timer.* issues
Change-Id: I1c3721403198b3c5525a811bd3c7cbf6b8e78e5b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/timer.cpp')
-rw-r--r--src/timer.cpp29
1 files changed, 29 insertions, 0 deletions
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" <romain.forlot@iot.bzh>
+ *
+ * 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