Thanks for sharing. That should help me on my windows machines.

On Tue, May 13, 2014 at 12:46 PM, Nate Fox <the...@gmail.com> wrote:

> Thanks for the detailed explanation. You gave me an idea with the +Z/+z,
> and you weren't kidding when you said Windows has issues (this adds to my
> existing disdain for Windows).
> For anyone else wondering, here's how I've solved my particular problem -
> which allows me to use the full date + time zone:
>
> if strftime($EventTime, "%Z") == "Pacific Daylight Time" set_var('myTZ',
> '07:00'); \
> else set_var('myTZ', '08:00');                                   \
> $EventTime = strftime($EventTime, "%Y-%m-%dT%H:%M:%S-"+get_var('myTZ'));
>
> Definitely not an elegant hack, but it allows me to keep my windows IIS
> servers with the existing system timezone. I guess if you wanted to really
> get fancy, you could get a list of time zones, set a +/- variable and
> adjust the %H in strftime with the +7 or -2 or whatever, then you'd have a
> converted UTC formatted date.
>
> In my travels, I also found this for windows:
> http://msdn.microsoft.com/en-us/library/fe06s4ak.aspx
> which led me to
> http://social.msdn.microsoft.com/Forums/vstudio/en-US/f76b8164-a918-4b74-b6d0-b38590c0a537/how-to-control-strftime-z-format?forum=vclanguage
> It didnt seem to work for me, but maybe someone else with more windows
> programming experience would know how to tweak %z/%Z through the TZ
> environment variable.
>
>
>
>
>
> On Tue, May 13, 2014 at 1:38 AM, Botond Botyanszki <b...@nxlog.org> wrote:
>
>> Hi,
>>
>> $EventTime is UTC.
>> It is not possible to convert it to a string representation with the UTC
>> timezone using strftime() because the underlying API does not support
>> this.
>> What you can do is:
>> * Use the Binary mode to transfer data. It serializes the datetime type
>>   correctly.
>> * Convert the datetime to a string expressed as an integer timestamp and
>>   parse it back at the other end.
>>   POC:
>>    #sender
>>    $EventTime = 2014-05-12 12:05:39;
>>    log_info($EventTime);
>>    $EventTime = string(integer($EventTime));
>>    log_info($EventTime);
>>    #receiver
>>    $EventTime = datetime(integer($EventTime));
>>    log_info($EventTime);
>>   This gives:
>>    2014-05-12 12:05:39
>>    1399889139000000
>>    2014-05-12 12:05:39
>> * Use +Z in strftime to format it with a timezone. This won't be UTC
>>   unless the machine is configured that way but it is human readable and
>>   can be parsed back. Windows has issues with the Z.
>>
>> Using JSON to serialize structured data has become quite popular recently.
>> Unfortunately there are two issues with this currently:
>> 1. The JSON standard does not define a datetime type. Doing a to_json()
>> and then a parse_json() results in $EventTime converted to a string, so
>> you need to add an explicit $EventTime = parsedate($EventTime);
>> There are plans to make this automatic.
>> 2. When the fields are serialized to JSON, the datetime type is converted
>> to a string expressed in local time without a timezone. Thus sending
>> data across timezones is problematic. This will be solved too.
>>
>> Regards,
>> Botond
>>
>>
>> On Mon, 12 May 2014 14:18:10 -0700
>> Nate Fox <the...@gmail.com> wrote:
>>
>> > I have the following on a windows machine:
>> >
>> > <Input event_viewer>
>> >     Module      im_msvistalog
>> >     Exec        $EventTime = strftime($EventTime, "%Y-%m-%dT%H:%M:%S");
>> > </Input>
>> >
>> > Is there any way to convert this to UTC regardless of what timezone I
>> have
>> > configured for the machine?
>> >
>> > I'd love something like strftime(to_utc($EventTime),
>> "%Y-%m-%dT%H:%M:%S");
>>
>>
>> ------------------------------------------------------------------------------
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos.
>> Get unparalleled scalability from the best Selenium testing platform
>> available
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> _______________________________________________
>> nxlog-ce-users mailing list
>> nxlog-ce-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users
>>
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> nxlog-ce-users mailing list
> nxlog-ce-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users
>
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
nxlog-ce-users mailing list
nxlog-ce-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users

Reply via email to