8520285e6f6ebc936b05043571db8508d1748ff7
[public/netxms.git] / src / server / core / uptimecalc.cpp
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003-2011 NetXMS Team
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** File: uptimecalc.cpp
20 **
21 **/
22
23 #include "nxcore.h"
24
25 //
26 // Uptime calculator thread
27 //
28
29 THREAD_RESULT THREAD_CALL UptimeCalculator(void *arg)
30 {
31 const int calcInterval = 60;
32
33 DbgPrintf(1, _T("UptimeCalculator thread started"));
34
35 while(TRUE)
36 {
37 g_pBusinessServiceRoot->updateUptimeStats(time(NULL), TRUE);
38 if (SleepAndCheckForShutdown(calcInterval))
39 break;
40 }
41
42 DbgPrintf(1, _T("UptimeCalculator thread terminated"));
43
44 return THREAD_OK;
45 }
46