Ok, I went through the replies just now, and did some google also. For my need I actually do not need to use any modules. I have a very simple requirement! Here is the code I wrote. In this I have put incrtime as 1 sec, but I can put any number of seconds I want, so no issues there!
#!/usr/bin/perl use strict; my $lat = 23.438; my $slon= 68.000; my $elon= 90.000; my $clon = $slon; my $incrlon= 0.01; my $time = time; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($ +time) ; my $incrtime=1; my $printmon; my $printyear; open OUTFILE,">tropic_of_cancer.gpx" or die \"Cannot open file for wri +ting\n"; print \"Printing Header...\n"; print OUTFILE "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"n +o\"?>\n"; print OUTFILE "<gpx version=\"1.1\" creator=\"MakeTropic\" xmlns=\"htt +p://www.topografix.com/GPX/1/1\" xmlns:xsi=\"http://www.w3.org/2001/X +MLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GP +X/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n"; print OUTFILE "<trk>\n"; print OUTFILE " <name>Tropic of Cancer</name>\n"; while ($clon < $elon) { $printmon = $mon+1; $printyear = $year+1900; print OUTFILE " <trkseg>\n"; printf OUTFILE (" <trkpt lat=\"%.3f\" lon=\"%.3f\">\n", +$lat,$clon); print OUTFILE " <time>$printyear-$printmon-$mday"." +T"."$hour:$min:$sec"."Z"."</time>\n"; print OUTFILE " </trkpt>\n"; $clon=$clon+$incrlon; $time=$time+$incrtime; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +$time) ; } print OUTFILE " </trkseg>\n"; print OUTFILE " </trk>\n"; print OUTFILE "</gpx>"; close OUTFILE;
It works fast and is tiny.

In reply to Solution found! by tsk1979
in thread Simple date and time manipulation by tsk1979

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.