+my $hexlasttime = 0;
+my $hexlastlet = 'A';
+
+sub hexstamp
+{
+ my $t = shift || $main::systime;
+ if ($t ne $hexlasttime) {
+ $hexlasttime = $t;
+ $hexlastlet = 'A';
+ } else {
+ do {
+ $hexlastlet = chr(ord($hexlastlet) + 1);
+ } while ($hexlastlet eq '^');
+ }
+ return sprintf "%c%08X", $hexlastlet, $hexlasttime;
+}
+
+sub pc58
+{
+ my $sort = shift;
+ my $hexstamp = shift || hexstamp();
+ my $from = shift;
+ my $to = shift;
+ my $text = unpad(shift);
+ $text = ' ' if !$text;
+ $text =~ s/\^/%5E/g;
+ return "PC58^$sort^$hexstamp^$from^$to^$text" . sprintf "^%s^", get_hops(58);
+}
+
+sub pc59
+{
+ my @out;
+ my $sort = shift;
+ my $hexstamp = shift || hexstamp();
+ my $node = shift;
+
+ my $s = "PC59^$sort^$hexstamp^$node";
+ for (@_) {
+ next unless $_;
+ my $ref = $_;
+ my $call = $ref->call;
+ my $here = $ref->here;
+ $s .= $ref->isa('Route::Node') ? "^N$here$call" : "^U$here$call";
+ }
+ push @out, sprintf "$s^%s^", get_hops(59);
+ return @out;
+}
+
+sub PC59c
+{
+ return PC59('C', @_);
+}
+
+sub PC59a
+{
+ return PC59('A', @_);
+}
+
+sub PC59d
+{
+ return PC59('D', @_);
+}
+