Hudson and system time

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Hudson and system time

Stevo Slavić
Hello Hudson users,

When I execute in Hudson following script:

def today = new Date()
println today

it prints out something like: Fri Jun 26 14:53:53 GMT 2009, so with timezone info included. In build history date-time printed doesn't have timezone info. How does Hudson determine in which timezone should it print date-time information? I expected date-time expressed in timezone configured for the server system/user (CEST in my case, which is GMT +2).

Regards,
Stevo.
Reply | Threaded
Open this post in threaded view
|

Re: Hudson and system time

Kohsuke Kawaguchi
Administrator
Stevo Slavić wrote:

> Hello Hudson users,
>
> When I execute in Hudson following script:
>
> def today = new Date()
> println today
>
> it prints out something like: Fri Jun 26 14:53:53 GMT 2009, so with timezone
> info included. In build history date-time printed doesn't have timezone
> info. How does Hudson determine in which timezone should it print date-time
> information? I expected date-time expressed in timezone configured for the
> server system/user (CEST in my case, which is GMT +2).
Yes. Also see http://wiki.hudson-ci.org/display/HUDSON/Change+time+zone

>
> Regards,
> Stevo.
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Hudson and system time

Stevo Slavić
Thanks Kohsuke,

Hudson instance and it's users are in the same timezone, and timezone seems to be set correctly on the server, so it's puzzling me why is Hudson displaying date-time info using GMT. Operating system on which Hudson is running is one of the recent OpenSUSE installements, and for user running Hudson's Tomcat regional settings is configured well (YAST and shell show correct date, time and timezone). Hardware clock is set to UTC ( == GMT), but local time is CEST. Haven't looked in the Hudson source code, but I guess there is a java.util.TimeZone.getDefault() implicit/explicit call somewhere. If I execute "println(java.util.TimeZone.getDefault())" script in Hudson I get "Greenwich Mean Time" (GMT) as response. Not sure why doesn't Java correctly detect and use system timezone as default.

One other related thought, maybe it wouldn't be that bad to have ability as Hudson user to set timezone in Hudson user preferences. By default it could be Hudson's default timezone, but on the other hand user should be able to adjust it to have date-time info displayed in user's own locale.

Regards,
Stevo.

On Sat, Jun 27, 2009 at 12:50 AM, Kohsuke Kawaguchi <[hidden email]> wrote:
Stevo Slavić wrote:
> Hello Hudson users,
>
> When I execute in Hudson following script:
>
> def today = new Date()
> println today
>
> it prints out something like: Fri Jun 26 14:53:53 GMT 2009, so with timezone
> info included. In build history date-time printed doesn't have timezone
> info. How does Hudson determine in which timezone should it print date-time
> information? I expected date-time expressed in timezone configured for the
> server system/user (CEST in my case, which is GMT +2).

Yes. Also see http://wiki.hudson-ci.org/display/HUDSON/Change+time+zone

>
> Regards,
> Stevo.
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/