|
Revision 2103, 2.4 kB
(checked in by karpet, 8 months ago)
|
whitespace only. again.
I am now using gnu indent rather than the original bsd version. My opts are below:
--no-blank-lines-after-declarations
--blank-lines-after-procedures
--no-blank-lines-after-commas
--break-before-boolean-operator
//--break-function-decl-args
//--break-function-decl-args-end
// long options above do not work. use short below instead.
-bfda
-bfde
--braces-on-if-line
--brace-indent4
--braces-after-struct-decl-line
--dont-cuddle-else
--comment-delimiters-on-blank-lines
--else-endif-column1
--no-space-after-casts
--declaration-indentation4
--paren-indentation4
--dont-format-first-column-comments
--dont-format-comments
--ignore-newlines
--line-length80
--indent-level4
--parameter-indentation5
--continue-at-parentheses
--no-space-after-function-call-names
--no-space-after-parentheses
--procnames-start-lines
--space-after-for
--space-after-if
--space-after-while
--dont-star-comments
--swallow-optional-blank-lines
--no-tabs
-TxmlChar?
-Tswish_ParserData
-Tswish_Config
-Tswish_3
-Tswish_Analyzer
-Tswish_Parser
-Tswish_DocInfo
-Tswish_TagStack
-Tswish_MetaName
-Tswish_Property
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#include <stdio.h> |
|---|
| 22 |
#include <time.h> |
|---|
| 23 |
#include "getruntime.c" |
|---|
| 24 |
#include "libswish3.h" |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
#ifdef HAVE_BSDGETTIMEOFDAY |
|---|
| 32 |
#define gettimeofday BSDgettimeofday |
|---|
| 33 |
#endif |
|---|
| 34 |
|
|---|
| 35 |
#ifdef NO_GETTOD |
|---|
| 36 |
|
|---|
| 37 |
double |
|---|
| 38 |
swish_time_elapsed( |
|---|
| 39 |
void |
|---|
| 40 |
) |
|---|
| 41 |
{ |
|---|
| 42 |
#ifdef HAVE_SYS_TIMEB_H |
|---|
| 43 |
#include <sys/timeb.h> |
|---|
| 44 |
|
|---|
| 45 |
struct timeb ftimebuf; |
|---|
| 46 |
|
|---|
| 47 |
ftime(&ftimebuf); |
|---|
| 48 |
return (double)ftimebuf.time + (double)ftimebuf.millitm / 1000.0; |
|---|
| 49 |
|
|---|
| 50 |
#else |
|---|
| 51 |
|
|---|
| 52 |
return ((double)clock()) / CLOCKS_PER_SEC; |
|---|
| 53 |
|
|---|
| 54 |
#endif |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
#else |
|---|
| 58 |
|
|---|
| 59 |
#include <sys/time.h> |
|---|
| 60 |
|
|---|
| 61 |
double |
|---|
| 62 |
swish_time_elapsed( |
|---|
| 63 |
void |
|---|
| 64 |
) |
|---|
| 65 |
{ |
|---|
| 66 |
struct timeval t; |
|---|
| 67 |
int i; |
|---|
| 68 |
|
|---|
| 69 |
i = gettimeofday(&t, NULL); |
|---|
| 70 |
if (i) |
|---|
| 71 |
return 0; |
|---|
| 72 |
|
|---|
| 73 |
return (double)(t.tv_sec + t.tv_usec / 1000000.0); |
|---|
| 74 |
} |
|---|
| 75 |
#endif |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
double |
|---|
| 79 |
swish_time_cpu( |
|---|
| 80 |
void |
|---|
| 81 |
) |
|---|
| 82 |
{ |
|---|
| 83 |
return (double)get_cpu_secs(); |
|---|
| 84 |
} |
|---|
| 85 |
|
|---|
| 86 |
char * |
|---|
| 87 |
swish_print_time( |
|---|
| 88 |
double time |
|---|
| 89 |
) |
|---|
| 90 |
{ |
|---|
| 91 |
int hh, mm, ss; |
|---|
| 92 |
int delta; |
|---|
| 93 |
char *str; |
|---|
| 94 |
|
|---|
| 95 |
if (time < 0) |
|---|
| 96 |
time = 0; |
|---|
| 97 |
|
|---|
| 98 |
delta = (int)(time + 0.5); |
|---|
| 99 |
ss = delta % 60; |
|---|
| 100 |
delta /= 60; |
|---|
| 101 |
hh = delta / 60; |
|---|
| 102 |
mm = delta % 60; |
|---|
| 103 |
|
|---|
| 104 |
str = swish_xmalloc(9); |
|---|
| 105 |
if (sprintf(str, "%02d:%02d:%02d", hh, mm, ss) > 0) { |
|---|
| 106 |
return str; |
|---|
| 107 |
} |
|---|
| 108 |
else { |
|---|
| 109 |
swish_xfree(str); |
|---|
| 110 |
return (char *)swish_xstrdup((xmlChar *)"unknown time"); |
|---|
| 111 |
} |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
char * |
|---|
| 115 |
swish_print_fine_time( |
|---|
| 116 |
double time |
|---|
| 117 |
) |
|---|
| 118 |
{ |
|---|
| 119 |
char *str; |
|---|
| 120 |
|
|---|
| 121 |
if (time >= 10) |
|---|
| 122 |
time = 9.99999; |
|---|
| 123 |
|
|---|
| 124 |
str = swish_xmalloc(8); |
|---|
| 125 |
if (sprintf(str, "%1.5f", time) > 0) |
|---|
| 126 |
return str; |
|---|
| 127 |
|
|---|
| 128 |
else { |
|---|
| 129 |
swish_xfree(str); |
|---|
| 130 |
return (char *)swish_xstrdup((xmlChar *)"unknown fine time"); |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
} |
|---|