ruby - How does Rails know my timezone? -
how rails know time zone? don't have set in application.rb
:
# config.time_zone = 'central time (us & canada)'
i searched whole app time_zone
, instance of it. don't see environment variables time zone set either. i'm on windows.
c:\users\chloe\workspace\mybestbody>rails runner "p time.now" dl deprecated, please use fiddle 2015-06-12 23:38:33 -0400
it prints utc time when deployed heroku.
c:\users\chloe\workspace\mybestbody>heroku run rails console running `rails console` attached terminal... up, run.1949 loading production environment (rails 4.2.1) irb(main):001:0> time.new => 2015-06-13 03:28:34 +0000
rails 4.2.1
from gettimeofday(), or ruby mri source have me believe:
int __cdecl gettimeofday(struct timeval *tv, struct timezone *tz) { filetime ft; getsystemtimeasfiletime(&ft); filetime_to_timeval(&ft, tv); return 0; }
per comment, c function, called ruby date routines under hood. not call method yourself, rather call ruby methods calling.
Comments
Post a Comment