mbgtools-lx  4.2.8
mbgsystm.c
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: mbgsystm.c 1.2 2017/07/05 10:06:36 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Generic functions to deal with the computer's system time
10  *
11  * -----------------------------------------------------------------------
12  * $Log: mbgsystm.c $
13  * Revision 1.2 2017/07/05 10:06:36 martin
14  * Made mbg_delta_sys_time_ms() an inline function,
15  * so this file is now effectively empty.
16  * Revision 1.1 2015/09/15 13:21:00 martin
17  * Initial revision.
18  * Moved existing code from different modules here.
19  *
20  **************************************************************************/
21 
22 #define _MBGSYSTM
23  #include <mbgsystm.h>
24 #undef _MBGSYSTM
25 
26 
27 #if 0
28 
29  /*HDR*/
38 long mbg_delta_sys_time_ms( const MBG_SYS_TIME *t2, const MBG_SYS_TIME *t1 )
39 {
40  #if defined( MBG_TGT_POSIX )
41  long dt = ( t2->secs - t1->secs ) * 1000;
42  #if defined ( MBG_TGT_LINUX ) && defined( MBG_TGT_KERNEL )
43  int64_t tmp64 = t2->nano_secs - t1->nano_secs;
44  do_div( tmp64, 1000000 );
45  dt += tmp64;
46  #else
47  dt += ( t2->nano_secs - t1->nano_secs ) / 1000000;
48  #endif
49  return dt;
50  #elif defined( MBG_TGT_WIN32 )
51  return (long) ( ( t2->QuadPart - t1->QuadPart ) / HNS_PER_MS );
52  #else
53  return 0;
54  #endif
55 
56 } // mbg_delta_sys_time_ms
57 
58 #endif
59 
#define HNS_PER_MS
Definition: mbgtime.h:272
A timestamp with nanosecond resolution, but 64 bit size.
Definition: words.h:621
static __mbg_inline long mbg_delta_sys_time_ms(const MBG_SYS_TIME *t2, const MBG_SYS_TIME *t1)
Compute delta between two MBG_SYS_TIME times, in milliseconds.
Definition: mbgsystm.h:364
__int64 int64_t
Definition: words.h:249
int64_t nano_secs
[nanoseconds]
Definition: words.h:628
int64_t secs
[seconds], usually since 1970-01-01 00:00:00
Definition: words.h:627