summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/opj_clock.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-05-09 15:44:46 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-05-09 20:46:20 +0200
commit563bd8499e63db976ca8358216138647593354bc (patch)
tree003599ed2b0cffd932d2122c3f72c142070efafd /src/lib/openjp2/opj_clock.c
parentd4e54e9f35d532062533f1d369c159810b01d224 (diff)
Reformat whole codebase with astyle.options (#128)
Diffstat (limited to 'src/lib/openjp2/opj_clock.c')
-rw-r--r--src/lib/openjp2/opj_clock.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/lib/openjp2/opj_clock.c b/src/lib/openjp2/opj_clock.c
index bb4cae73..ab026ea2 100644
--- a/src/lib/openjp2/opj_clock.c
+++ b/src/lib/openjp2/opj_clock.c
@@ -1,6 +1,6 @@
/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
+ * The copyright in this software is being made available under the 2-clauses
+ * BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@@ -39,27 +39,29 @@
#include <sys/times.h>
#endif /* _WIN32 */
-OPJ_FLOAT64 opj_clock(void) {
+OPJ_FLOAT64 opj_clock(void)
+{
#ifdef _WIN32
- /* _WIN32: use QueryPerformance (very accurate) */
- LARGE_INTEGER freq , t ;
+ /* _WIN32: use QueryPerformance (very accurate) */
+ LARGE_INTEGER freq, t ;
/* freq is the clock speed of the CPU */
QueryPerformanceFrequency(&freq) ;
- /* cout << "freq = " << ((double) freq.QuadPart) << endl; */
+ /* cout << "freq = " << ((double) freq.QuadPart) << endl; */
/* t is the high resolution performance counter (see MSDN) */
- QueryPerformanceCounter ( & t ) ;
- return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ;
+ QueryPerformanceCounter(& t) ;
+ return (t.QuadPart / (OPJ_FLOAT64) freq.QuadPart) ;
#else
- /* Unix or Linux: use resource usage */
+ /* Unix or Linux: use resource usage */
struct rusage t;
OPJ_FLOAT64 procTime;
/* (1) Get the rusage data structure at this moment (man getrusage) */
- getrusage(0,&t);
+ getrusage(0, &t);
/* (2) What is the elapsed time ? - CPU time = User time + System time */
- /* (2a) Get the seconds */
+ /* (2a) Get the seconds */
procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec);
/* (2b) More precisely! Get the microseconds part ! */
- return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ;
+ return (procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) *
+ 1e-6) ;
#endif
}