| 1 |
/// @file |
| 2 |
/// @ingroup common_utils |
| 3 |
/************************************************************************* |
| 4 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 5 |
* All rights reserved. This program and the accompanying materials |
| 6 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 7 |
* which accompanies this distribution, and is available at |
| 8 |
* https://www.eclipse.org/legal/epl-v10.html |
| 9 |
* |
| 10 |
* Contributors: Details at https://graphviz.org |
| 11 |
*************************************************************************/ |
| 12 |
|
| 13 |
#include "config.h" |
| 14 |
|
| 15 |
#include <common/types.h> |
| 16 |
#include <common/utils.h> |
| 17 |
#include <time.h> |
| 18 |
|
| 19 |
static clock_t T; |
| 20 |
|
| 21 |
void start_timer(void) { T = clock(); } |
| 22 |
|
| 23 |
double elapsed_sec(void) { |
| 24 |
const clock_t S = clock(); |
| 25 |
return (S - T) / (double)CLOCKS_PER_SEC; |
| 26 |
} |