From 92027ce650e8af042e624dc5d16cc73db2acc853 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 14 Dec 2019 05:21:29 -0500 Subject: [PATCH] Add script to estimate when a block will occur --- contrib/block_time.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 contrib/block_time.pl diff --git a/contrib/block_time.pl b/contrib/block_time.pl new file mode 100755 index 000000000..784d05b12 --- /dev/null +++ b/contrib/block_time.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# Copyright 2019 The Hush developers +# Released under the GPLv3 +use warnings; +use strict; + +# Given a block time, estimate when it will happen +my $block = shift || die "Usage: $0 123"; +my $hush = "./src/hush-cli"; +my $blockcount = qx{$hush getblockcount}; + +if ($block <= $blockcount) { + die "That block has already happened!"; +} else { + my $diff = $block - $blockcount; + my $minutes = $diff*2.5; + my $seconds = $minutes*60; + my $now = time; + my $then = $now + $seconds; + my $date = localtime($then); + print "Hush Block $block will happen at roughly:\n"; + print "$date # $then\n"; +}