Am 12.11.2012 15:45, schrieb Hassan Schroeder:
> On Mon, Nov 12, 2012 at 6:23 AM,  <sto.mar / web.de> wrote:
>
>>> t1=Time::parse(current_date+' '+current_time)
>
> I think that should be DateTime::parse, but ...

The OP was using Time.parse from the `Time' library.

>> Simply use `t1 = Time.new', which returns the current system time.
>
> The OP should be aware that parsing a time out of a string value as
> we're doing here will, in the absence of any timezone data, assume a
> TZ offset of 0 (UTC/GMT).
[...]
> So if you're trying to compare 2 times, make sure they're using the
> same TZ offset as well, or your results will be, erm, suspect :-)

Generally, this is a very good point.

But for the considered example, Time.parse returns local time,
since no time zone was specified in the argument, so it should work.


-- 
<https://github.com/stomar/>