
MaxScaleUptime() renamed to maxscale_uptime() and moved from gateway.c (MaxScale main) to misc.c, which is included in the maxscale_common library. That way the symbol will be available at link-time and will thus not prevent the use of the linker flags -Wl,-z,defs (resolve all symbols at link-time) when linking a module that uses maxscale_uptime().
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
/*
|
|
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
|
|
* software: you can redistribute it and/or modify it under the terms of the
|
|
* GNU General Public License as published by the Free Software Foundation,
|
|
* version 2.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program; if not, write to the Free Software Foundation, Inc., 51
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Copyright MariaDB Corporation Ab 2016
|
|
*
|
|
*/
|
|
|
|
#include <maxscale.h>
|
|
#include <time.h>
|
|
|
|
static time_t maxscale_started;
|
|
|
|
/**
|
|
* Reset the start time from which the uptime is calculated.
|
|
*/
|
|
void maxscale_reset_uptime(void)
|
|
{
|
|
maxscale_started = time(0);
|
|
}
|
|
|
|
/**
|
|
* Return the time MaxScale has been running.
|
|
*
|
|
* @return The uptime in seconds.
|
|
*/
|
|
int maxscale_uptime()
|
|
{
|
|
return time(0) - maxscale_started;
|
|
}
|