diff options
author | Tails developers <amnesia@boum.org> | 2014-12-19 00:40:08 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-12-21 09:45:40 +0100 |
commit | 51680b6ebb645d37ebdfcd122ca163b3a638aefa (patch) | |
tree | 337e128d2eac3cbc89ecbacf38851bfa33469cd5 /features/step_definitions/time_syncing.rb | |
parent | 44bab3c86ca3d95837f4c50cc535206352385a46 (diff) | |
download | jenkins.debian.net-51680b6ebb645d37ebdfcd122ca163b3a638aefa.tar.xz |
files copied from https://git-tails.immerda.ch/tails - many thanks to the tails developers for their nice work and documentation of it - these files have been released under the GNU General Public License version 3 or (at your option) any later version
features/images has been omitted
Diffstat (limited to 'features/step_definitions/time_syncing.rb')
-rw-r--r-- | features/step_definitions/time_syncing.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/features/step_definitions/time_syncing.rb b/features/step_definitions/time_syncing.rb new file mode 100644 index 00000000..161a4162 --- /dev/null +++ b/features/step_definitions/time_syncing.rb @@ -0,0 +1,20 @@ +When /^I set the system time to "([^"]+)"$/ do |time| + next if @skip_steps_while_restoring_background + @vm.execute("date -s '#{time}'") +end + +When /^I bump the system time with "([^"]+)"$/ do |timediff| + next if @skip_steps_while_restoring_background + @vm.execute("date -s 'now #{timediff}'") +end + +Then /^Tails clock is less than (\d+) minutes incorrect$/ do |max_diff_mins| + next if @skip_steps_while_restoring_background + guest_time_str = @vm.execute("date --rfc-2822").stdout.chomp + guest_time = Time.rfc2822(guest_time_str) + host_time = Time.now + diff = (host_time - guest_time).abs + assert(diff < max_diff_mins.to_i*60, + "The guest's clock is off by #{diff} seconds (#{guest_time})") + puts "Time was #{diff} seconds off" +end |