https://github.com/barrust/timing-c
Basic timing functionality for C programs
https://github.com/barrust/timing-c
Last synced: 6 months ago
JSON representation
Basic timing functionality for C programs
- Host: GitHub
- URL: https://github.com/barrust/timing-c
- Owner: barrust
- License: mit
- Created: 2015-08-07T00:47:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-24T00:39:20.000Z (about 7 years ago)
- Last Synced: 2025-06-07T13:01:42.287Z (7 months ago)
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timing-c
### Purpose:
This header utility is to be able to quickly provide timing functionality to standard c code. It is designed to be beneficial to me as I am tired of re-writting the same type of functionality. I hope it is beneficial to others.
### License:
Copyright 2015 Licensed under the MIT License
### Usage:
```c
#include
#include
#include "timing.h"
Timing t;
timing_start(&t);
// code to time here
timing_end(&t);
printf("time elapsed: %f\n", t.timing_double);
// get to elapsed time elements easily
printf("hours: %d\n", timing_get_hours(t));
printf("minutes: %d\n", timing_get_minutes(t));
printf("seconds: %d\n", timing_get_seconds(t));
printf("milliseconds: %d\n", timing_get_milliseconds(t));
printf("microseconds: %d\n", timing_get_microseconds(t));
// get to a pretty print version
char* output = format_time_diff(&t);
printf("pretty output: %s\n", output);
free(output);
```