<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hi Perlmongers,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here's a tricky one to do with times and dates.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm trying to generate a timeseries. The start and end time are user-defined, as is the timestep interval. So, if I start at 06/01/1990 00:00:00, and end at 06/01/1990 00:12:00, and specify a timestep of 6 minutes, I will get a timeseries like this...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>06/01/1990 00:00:00</DIV><DIV>06/01/1990 00:06:00</DIV><DIV>06/01/1990 00:12:00</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I will also be reading historic rainfall data, and applying the amount of rainfall to each timestep. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This requires that I read and write calendar date data in the human-friendly long format 01/01/1900 00:00:00, and do functions in terms of seconds since the epoch.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The sub for interpreting human-friendly time-date data into computer friendly seconds-since-epoch is as follows...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>sub Calendar_date_string_to_timevalue {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>#Sub version 1.0</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>#This sub converts a string to a time value</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>#The format of the string is DD/MM/YYYY hh:mm:ss, e.g. 25/02/1990 23:48:00</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>#The sub parses the string, then uses timegm to calculate its value in terms of seconds since the Epoch</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>my (%arg) <SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>= @_;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>my $t <SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>= $arg{arg1};</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>my ($mday, $mon, $year, $hour, $min, $sec) = $$t =~ /(\d+)/g;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$$t = timegm $sec, $min, $hour, $mday, $mon - 1, $year - 1900;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm using timegm, because the timesteps must be mathematically consequential (every timestep must occur after the preceding timestep). There are other functions, but some do corrections for daylight savings etc, which I don't want.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>My problem is that the output goes wrong for dates before 01/Jan/1970 00:00:00 (I think, when timevalue in seconds-since-epoch is 0). Some of my timeseries may run to 1900, or even earlier, but the sub above refuses to generate a consequential series (1901, for example, gets interpreted as 2001).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>BTW, I'm using Mac OSX, but the program I'm writing needs to run on any operating system.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks in advance for any help...</DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Regards,</DIV><DIV>Martin</DIV><DIV>Visit my website...</DIV><DIV><A href="http://web.mac.com/martin_jacobs1"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">http://web.mac.com/martin_jacobs1 </SPAN></A></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN> </DIV><BR></BODY></HTML>