]> scm.dxcluster.org Git - dweather.git/commitdiff
prefer rename over copy for loop_data shuffle
authorDirk Koopman <djk@tobit.co.uk>
Sat, 24 Jan 2015 00:04:26 +0000 (00:04 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 24 Jan 2015 00:04:26 +0000 (00:04 +0000)
loop.pl

diff --git a/loop.pl b/loop.pl
index ef8a6734c64ef6ebf14418cf978e71964a86b885..b5e939dd5a3e6cdd5fc1aaafe96cd966f7e03235 100755 (executable)
--- a/loop.pl
+++ b/loop.pl
@@ -14,6 +14,7 @@ use Debug;
 use SMGLog;
 use Math::Round qw(nearest);
 use File::Copy;
+use Data::Random qw(rand_chars);
 
 use constant pi => 3.14159265358979; 
 
@@ -155,12 +156,7 @@ write_ld();
 close $dataf if $dataf;
 
 # move all the files along one 
-copy "$datafn.oooo", "$datafn.ooooo";
-copy "$datafn.ooo", "$datafn.oooo";
-copy "$datafn.oo", "$datafn.ooo";
-copy "$datafn.o", "$datafn.oo";
-copy $datafn, "$datafn.o";
-
+cycle_loop_data_files();
 
 dbg '***';
 dbg "*** ending $0";
@@ -664,6 +660,14 @@ sub write_ld
        print $dataf "$s\n";
 }
 
+sub cycle_loop_data_files
+{
+       rename "$datafn.oooo", "$datafn.ooooo";
+       rename "$datafn.ooo", "$datafn.oooo";
+       rename "$datafn.oo", "$datafn.ooo";
+       rename "$datafn.o", "$datafn.oo";
+       copy $datafn, "$datafn.o";
+}
 
 __DATA__
  
@@ -745,7 +749,7 @@ __DATA__
 <th>Minute Avg:<td> <span id="Wind_1m">  </span>
 
 <tr>
-<th>Rain Hour:<td> <span id="Rain_1h"> </span>
+<th>Rain 30mins:<td> <span id="Rain_1h"> </span>
 <th>Day:<td> <span id="Rain_Day"> </span>
 <th>24hrs:<td> <span id="Rain_24h"> </span>
 <th>Month:<td> <span id="Rain_Month"> </span>