We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
gettimeofday
1 parent c6d562e commit f459bc0Copy full SHA for f459bc0
1 file changed
src/utils.c
@@ -184,6 +184,22 @@ int add_iso8601_utc_datetime(char* buf, size_t size) {
184
185
#endif
186
187
+#ifdef ARDUINO
188
+
189
+int64_t usec_now()
190
+{
191
+ return micros();
192
+}
193
194
+void get_time(uint32_t *seconds, uint32_t *micro_seconds)
195
196
+ *micro_seconds = micros();
197
+ *seconds = *micro_seconds / 1000000;
198
+ *micro_seconds %= 1000000;
199
200
201
+#else
202
203
int64_t usec_now()
204
{
205
int64_t usec;
@@ -204,6 +220,8 @@ void get_time(uint32_t *seconds, uint32_t *micro_seconds)
220
*micro_seconds = tv.tv_usec;
221
}
206
222
223
+#endif
224
207
225
int64_t usec_since(int64_t last)
208
226
209
227
return usec_now() - last;
0 commit comments