+sub dec_obs
+{
+ my $self = shift;
+ $self->{obscount}--;
+ return $self->{obscount};
+}
+
+sub reset_obs
+{
+ my $self = shift;
+ $self->{obscount} = $obscount;
+}
+
+sub measure_pc9x_t
+{
+ my $parent = shift;
+ my $t = shift;
+ my $lastid = $parent->{lastid};
+ if ($lastid) {
+ return ($t < $lastid) ? $t+86400-$lastid : $t - $lastid;
+ } else {
+ return 86400;
+ }
+}
+
+sub PC92C_dxchan
+{
+ my $parent = shift;
+ my $call = shift;
+ my $hops = shift;
+ if ($call && $hops) {
+ $hops =~ s/^H//;
+ $parent->{PC92C_dxchan}->{$call} = $hops;
+ return;
+ }
+ return (%{$parent->{PC92C_dxchan}});
+}
+
+sub TO_JSON { return { %{ shift() } }; }
+
+sub write_cache
+{
+ my $json = DXJSON->new;
+ $json->canonical(0)->allow_blessed(1)->convert_blessed(1);
+
+ my $ta = [ gettimeofday ];
+ $json->indent(1)->canonical(1) if isdbg('routecache');
+ my $s = eval {$json->encode(\%list)};
+ if ($s) {
+ my $fh = IO::File->new(">$cachefn") or confess("writing $cachefn $!");
+ $fh->print($s);
+ $fh->close;
+ } else {
+ dbg("Route::User:Write_cache error '$@'");
+ return;
+ }
+ $json->indent(0)->canonical(0);
+ my $diff = _diffms($ta);
+ my $size = sprintf('%.3fKB', (length($s) / 1000));
+ dbg("Route::User:WRITE_CACHE size: $size time to write: $diff mS");
+}
+
+