OpenOCD
time_support_common.c
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
3
/***************************************************************************
4
* Copyright (C) 2006 by Dominic Rath *
5
* Dominic.Rath@gmx.de *
6
* *
7
* Copyright (C) 2007,2008 Øyvind Harboe *
8
* oyvind.harboe@zylin.com *
9
* *
10
* Copyright (C) 2008 by Spencer Oliver *
11
* spen@spen-soft.co.uk *
12
***************************************************************************/
13
14
#ifdef HAVE_CONFIG_H
15
#include "
config.h
"
16
#endif
17
18
#include "
time_support.h
"
19
20
/* simple and low overhead fetching of ms counter. Use only
21
* the difference between ms counters returned from this fn.
22
*/
23
int64_t
timeval_ms
(
void
)
24
{
25
struct
timeval
now;
26
int
retval =
gettimeofday
(&now,
NULL
);
27
if
(retval < 0)
28
return
retval;
29
return
(int64_t)now.
tv_sec
* 1000 + now.
tv_usec
/ 1000;
30
}
config.h
gettimeofday
int gettimeofday(struct timeval *tv, struct timezone *tz)
timeval
Definition:
replacements.h:45
timeval::tv_sec
long tv_sec
Definition:
replacements.h:46
timeval::tv_usec
long tv_usec
Definition:
replacements.h:47
time_support.h
timeval_ms
int64_t timeval_ms(void)
Definition:
time_support_common.c:23
NULL
#define NULL
Definition:
usb.h:16
src
helper
time_support_common.c
Generated by
1.9.1