[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem processing data logs

From: Mike Miller
Subject: Re: Problem processing data logs
Date: Thu, 3 Jan 2019 13:44:49 -0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Jan 03, 2019 at 13:25:23 +0000, Ian McCallion wrote:
> Is there another way to implement  mylocaltime()  in Octave without
> recoding from scratch the logic needed to process a timezone string?

If setting and unsetting the TZ environment variable is a big problem on
Windows, I can't think of another way to do it readily in Octave at the

However, you might be able to rely on an external program which has a
separate environment space. The following example works for me (on

    function lt = mylocaltime (seconds, tz)     
      fmt = "%S %M %H %d %m %Y";
      cmd = sprintf ("env TZ='%s' date address@hidden +'%s'", tz, seconds, fmt);
      [status, output] = system (cmd);
      values = str2double (strsplit (output));
      lt.sec = values(1);
      lt.min = values(2);
      lt.hour = values(3);
      lt.mday = values(4);
      lt.mon = values(5);
      lt.year = values(6);

You can tailor this to whichever broken-down time fields you need to


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]