Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let user specify the start-time of the program #496

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

erlingrj
Copy link
Collaborator

@erlingrj erlingrj commented Nov 11, 2024

This PR adds a new command line argument -s --start-time that allows the user to specify the start time of the program. This currently only works for non-federated programs. In a federated setting the program will then wait until the specified start time (if it is in the future) before reaching out to the RTI and negotiating a start time.

Currently there are no tests for this feature, but I have tested it on my end.

@erlingrj erlingrj requested a review from edwardalee November 11, 2024 01:51
@erlingrj erlingrj added the enhancement Enhancement of existing feature label Nov 11, 2024
Copy link
Contributor

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very useful, but there are two issues:

  1. The start time is not a duration, so the usage message and variable names should be updated. It's an absolute start time.
  2. It would be useful to have some hints about how to specify a start time. It requires units, but on a POSIX machine, it will be specifying the number of nanoseconds since Jan. 1, 1970. Maybe there is a utility function that will tell me what, say, 2PM today is in seconds?

@erlingrj
Copy link
Collaborator Author

erlingrj commented Dec 9, 2024

Thanks for your feedback Edward! I have done a couple of changes:

  1. Better help message:
  -s, --start-time <time-point> <units> 
   The logical start time of the program, expressed as an absolute time point
   which is the duration since the epoch of the underlying system clock.
   The units are nsec, usec, msec, sec, minute, hour, day, week or the plurals of those.
   On linux, to compute a start time of 2 minutes into the future, expressed in seconds, you can do:.
     `date -d "2 minutes" +%s`.
  1. Dont wait for start_time to arrive if fast mode is enabled
  2. Refactor the setting and waiting for start time into a function that can be used by both unthreaded and threaded execution

@erlingrj erlingrj requested a review from edwardalee December 9, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants