Debian Codegraph @

src/bnetd/tick.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 1999,2000 Ross Combs ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
19 #include "tick.h"cxx . . $ `<file>/src/bnetd/tick.h`/
20
21 #include <cerrno>
22 #include <cstddef>
23 #include <cstring>
24
25 #include "compat/gettimeofday.h"cxx . . $ `<file>/src/compat/gettimeofday.h`/
26 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
27
28 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
29
30
31 namespace pvpgncxx . . $ pvpgn/
32 {
33
34 namespace bnetdcxx . . $ pvpgn/bnetd/
35 {
36
37 /*
38 * This routine returns the number of miliseconds that have passed since one second
39 * before it is first called. This is used for timing fields in some packets.
40 */
41 extern unsigned int get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).(void)
42 {
43 static int first = 1;
44 static long beginsec;
45 struct timevalcxx . . $ timeval# tv;
46
47 if (gettimeofday(&tv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) < 0)
48 {
49 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not get std::time (gettimeofday: {})", stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
50 return 0;
51 }
52 if (first)
53 {
54 beginsec = tv.tv_seccxx . . $ timeval#tv_sec. - 1;
55 first = 0;
56 }
57
58 return (unsigned int)((tv.tv_seccxx . . $ timeval#tv_sec. - beginsec) * 1000 + tv.tv_useccxx . . $ timeval#tv_usec. / 1000);
59 }
60
61 }
62
63 }