Strange... Or more likely I don't understand what is going on here, being a noob. Your suggestion about using the epochs helped me at least figure out a way around my problem. If I add:

$oldtime = $oldtime - $ctime->tzoffset;

I get the desired results, although my statement

print "The old time is $oldtime\n";

Then prints a formatted time 6 hours in the future. I needed to update that to

print "The old time is ", $oldtime + $ctime->tzoffset, "\n";

To get it to print the correct time. That isn't a great concern as I actually won't ever be using the print statements, only the calculations, in the bigger script I am retrofitting. Still, it shows I am missing something basic in how this all works and that concerns me.


In reply to Re^2: Simple (I thought) time comparison? by sjessie
in thread Simple (I thought) time comparison? by sjessie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.