Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
wiback
senf
Commits
d9430f0b
Commit
d9430f0b
authored
16 years ago
by
g0dil
Browse files
Options
Downloads
Patches
Plain Diff
Scheduler: Document the ClockService conversion members (microseconds...)
Scheduler: Add reverse conversion helpers to ClockService
parent
6476a41f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Scheduler/ClockService.cci
+42
-7
42 additions, 7 deletions
Scheduler/ClockService.cci
Scheduler/ClockService.hh
+16
-7
16 additions, 7 deletions
Scheduler/ClockService.hh
with
58 additions
and
14 deletions
Scheduler/ClockService.cci
+
42
−
7
View file @
d9430f0b
...
...
@@ -57,41 +57,76 @@ prefix_ senf::ClockService::clock_type senf::ClockService::from_timeval(timeval
return from_time_t(time.tv_sec) + ClockService::microseconds(time.tv_usec);
}
prefix_ senf::ClockService::clock_type senf::ClockService::nanoseconds(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::nanoseconds(
int64
_type v)
{
return v;
}
prefix_ senf::ClockService::clock_type senf::ClockService::microseconds(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::microseconds(
int64
_type v)
{
return v * nanoseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::milliseconds(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::milliseconds(
int64
_type v)
{
return v * microseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::seconds(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::seconds(
int64
_type v)
{
return v * milliseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::minutes(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::minutes(
int64
_type v)
{
return v * seconds(60);
}
prefix_ senf::ClockService::clock_type senf::ClockService::hours(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::hours(
int64
_type v)
{
return v * minutes(60);
}
prefix_ senf::ClockService::clock_type senf::ClockService::days(
clock
_type v)
prefix_ senf::ClockService::clock_type senf::ClockService::days(
int64
_type v)
{
return v * hours(24);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_nanoseconds(int64_type v)
{
return v;
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_microseconds(int64_type v)
{
return v / nanoseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_milliseconds(int64_type v)
{
return v / microseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_seconds(int64_type v)
{
return v / milliseconds(1000);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_minutes(int64_type v)
{
return v / seconds(60);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_hours(int64_type v)
{
return v / minutes(60);
}
prefix_ senf::ClockService::clock_type senf::ClockService::in_days(int64_type v)
{
return v / hours(24);
}
prefix_ void senf::ClockService::restart()
{
instance().restart_m();
...
...
This diff is collapsed.
Click to expand it.
Scheduler/ClockService.hh
+
16
−
7
View file @
d9430f0b
...
...
@@ -98,6 +98,7 @@ namespace senf {
nanoseconds relative to some implementation defined reference time.
*/
typedef
boost
::
int_fast64_t
clock_type
;
typedef
boost
::
int_fast64_t
int64_type
;
/** \brief Absolute time data type
...
...
@@ -141,13 +142,21 @@ namespace senf {
/**< This member converts an absolute time value
represented as a timeval value into a clock value */
static
clock_type
nanoseconds
(
clock_type
v
);
static
clock_type
microseconds
(
clock_type
v
);
static
clock_type
milliseconds
(
clock_type
v
);
static
clock_type
seconds
(
clock_type
v
);
static
clock_type
minutes
(
clock_type
v
);
static
clock_type
hours
(
clock_type
v
);
static
clock_type
days
(
clock_type
v
);
static
clock_type
nanoseconds
(
int64_type
v
);
///< Convert \a v nanoseconds to clock_type
static
clock_type
microseconds
(
int64_type
v
);
///< Convert \a v microseconds to clock_type
static
clock_type
milliseconds
(
int64_type
v
);
///< Convert \a v milliseconds to clock_type
static
clock_type
seconds
(
int64_type
v
);
///< Convert \a v seconds to clock_type
static
clock_type
minutes
(
int64_type
v
);
///< Convert \a v minutes to clock_type
static
clock_type
hours
(
int64_type
v
);
///< Convert \a v hours to clock_type
static
clock_type
days
(
int64_type
v
);
///< Convert \a v days to clock_type
static
int64_type
in_nanoseconds
(
clock_type
v
);
///< Convert \a v to nanoseconds
static
int64_type
in_microseconds
(
clock_type
v
);
///< Convert \a v to microseconds
static
int64_type
in_milliseconds
(
clock_type
v
);
///< Convert \a v to milliseconds
static
int64_type
in_seconds
(
clock_type
v
);
///< Convert \a v to seconds
static
int64_type
in_minutes
(
clock_type
v
);
///< Convert \a v to minutes
static
int64_type
in_hours
(
clock_type
v
);
///< Convert \a v to hours
static
int64_type
in_days
(
clock_type
v
);
///< Convert \a v to days
static
void
restart
();
...
...
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