blob: 8b0fa1490b86b4c774ddb939eda9999d23a93269 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 * Server management functions.
3 *
4 * Copyright 2000-2006 Willy Tarreau <w@1wt.eu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020013#include <common/config.h>
Krzysztof Oledzki85130942007-10-22 16:21:10 +020014#include <common/time.h>
15
Willy Tarreaubaaee002006-06-26 02:48:02 +020016#include <types/backend.h>
17#include <types/proxy.h>
18#include <types/server.h>
19
Krzysztof Oledzki85130942007-10-22 16:21:10 +020020int srv_downtime(struct server *s) {
21
22 if ((s->state & SRV_RUNNING) && s->last_change < now.tv_sec) // ignore negative time
23 return s->down_time;
24
25 return now.tv_sec - s->last_change + s->down_time;
26}
Willy Tarreaubaaee002006-06-26 02:48:02 +020027
28/*
29 * Local variables:
30 * c-indent-level: 8
31 * c-basic-offset: 8
32 * End:
33 */