Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
1a2e49aa
Commit
1a2e49aa
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Change the timestamp to [ssssss.s] to reduce the length of the stdout lines.
parent
7ed1d30a
No related branches found
No related tags found
2 merge requests
!136
Master
,
!107
Code timing and verbosity
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
src/clocks.c
+5
-21
5 additions, 21 deletions
src/clocks.c
with
6 additions
and
22 deletions
configure.ac
+
1
−
1
View file @
1a2e49aa
...
@@ -329,7 +329,7 @@ is defined in <sys/time.h>])],,
...
@@ -329,7 +329,7 @@ is defined in <sys/time.h>])],,
[#if HAVE_SYS_TIME_H
[#if HAVE_SYS_TIME_H
#include <sys/time.h>
#include <sys/time.h>
#endif])
#endif])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time
strftime gettimeofday localtime
])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time])
AC_MSG_CHECKING([for _rtc intrinsic])
AC_MSG_CHECKING([for _rtc intrinsic])
rtc_ok=yes
rtc_ok=yes
AC_LINK_IFELSE([AC_LANG_PROGRAM(
AC_LINK_IFELSE([AC_LANG_PROGRAM(
...
...
This diff is collapsed.
Click to expand it.
src/clocks.c
+
5
−
21
View file @
1a2e49aa
...
@@ -227,34 +227,18 @@ double clocks_from_ticks(ticks tics) {
...
@@ -227,34 +227,18 @@ double clocks_from_ticks(ticks tics) {
const
char
*
clocks_getunit
()
{
return
clocks_units
[
clocks_units_index
];
}
const
char
*
clocks_getunit
()
{
return
clocks_units
[
clocks_units_index
];
}
/**
/**
* @brief returns the time
of day to 1/10th second accuracy.
* @brief returns the time
since the start of the execution in seconds
*
*
* The
dat
e is return in the format [
hh:mm:
ss.s]
* The
tim
e is return in the format [
ssss
ss.s]
*
*
* @result the
current time of day.
* @result the
time since the start of the execution
*/
*/
const
char
*
clocks_get_timeofday
()
{
const
char
*
clocks_get_timeofday
()
{
static
char
buffer
[
40
];
static
char
buffer
[
40
];
#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_LOCALTIME) && \
sprintf
(
buffer
,
"[%08.1f]"
,
defined(HAVE_STRFTIME)
clocks_diff_ticks
(
getticks
(),
clocks_start
)
/
1000
.
0
);
struct
timespec
time
;
struct
tm
*
local_time
;
char
fmttime
[
40
];
clock_gettime
(
CLOCK_REALTIME
,
&
time
);
local_time
=
localtime
(
&
time
.
tv_sec
);
/* Make it a string */
strftime
(
fmttime
,
40
,
"%T"
,
local_time
);
/* 1/10 seconds. */
int
tseconds
=
time
.
tv_nsec
/
100000000
;
sprintf
(
buffer
,
"[%s.%01d]"
,
fmttime
,
tseconds
);
#else
sprintf
(
buffer
,
"[%08.1f]"
,
clocks_diff_ticks
(
getticks
(),
clocks_start
)
/
100
.
0
);
#endif
return
buffer
;
return
buffer
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment