Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
44426c99
Commit
44426c99
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
minor tuneups, preparing to convert to java.time
parent
18f259d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/edu/nps/moves/dis7/utilities/DisTime.java
+29
-1
29 additions, 1 deletion
src/edu/nps/moves/dis7/utilities/DisTime.java
with
29 additions
and
1 deletion
src/edu/nps/moves/dis7/utilities/DisTime.java
+
29
−
1
View file @
44426c99
...
...
@@ -114,6 +114,7 @@ public class DisTime
/** Unix time (seconds since 1 January 1970) */
UNIX
,
/** hundreds of a second since the start of the year */
@Deprecated
YEAR
};
...
...
@@ -218,6 +219,31 @@ public class DisTime
differenceTimestamp
=
(
int
)
differenceValue
;
return
differenceTimestamp
;
}
/**
* Recommended form, checks local system clock and returns the current DIS standard relative timestamp based on current timestampStyle.
* @see <a href="https://en.wikipedia.org/wiki/Network_Time_Protocol" target="_blank">Wikipedia: Network Time Protocol (NTP)</a>
* @return DIS time units, relative
*/
public
static
int
getCurrentDisTimestamp
()
{
switch
(
timestampStyle
)
{
case
IEEE_ABSOLUTE:
return
getCurrentDisAbsoluteTimestamp
();
case
IEEE_RELATIVE:
return
getCurrentDisRelativeTimestamp
();
case
UNIX:
return
getCurrentUnixTimestamp
();
case
YEAR:
// formerly NPS:
return
getCurrentYearTimestamp
();
default
:
return
getCurrentDisAbsoluteTimestamp
();
// superfluous
}
}
/**
* Checks local system clock and returns the current DIS standard absolute timestamp, assuming that this host is synchronized to NTP.
...
...
@@ -335,6 +361,7 @@ public class DisTime
}
}
// TODO is reflection really necessary? simpler is better
private
static
void
initializeTimestampMethod
()
{
try
{
...
...
@@ -427,7 +454,8 @@ public class DisTime
*/
public
static
void
setEpochLvc
(
java
.
time
.
Instant
newEpoch
)
{
epochLvc
=
newEpoch
;
applyEpochLvc
=
true
;
setEpochLvc
(
newEpoch
);
}
/** Get initial timestamp for zero-based clock, meaning all timestamps are measured with respect to given starting time
* @return whether localhost is synchronized to time reference
...
...
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