I deployed an app to an OS X (10.6.8) server, and launch time for the app was shockingly slow, but performance after launch was fine. The problem turns out to be this line in application.rb: config.time_zone = /Time Zone: (.*)$/.match(`systemsetup -gettimezone`)[1] Yes, that''s right, systemsetup -gettimezone takes a full 30 seconds to run on this Mac. (Mac Pro, fairly recent, Xeon, tons of RAM, almost non-existent CPU load). Anybody have any idea wtf that''s about??? I''ve just hard-coded the time zone default and it''s fine. But still, just wondering if anybody has a clue? -- Scott Ribe scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Scott Ribe wrote in post #1091858:> I deployed an app to an OS X (10.6.8) server, and launch time for the > app was shockingly slow, but performance after launch was fine. > > The problem turns out to be this line in application.rb: > > config.time_zone = /Time Zone: (.*)$/.match(`systemsetup > -gettimezone`)[1] > > Yes, that''s right, systemsetup -gettimezone takes a full 30 seconds to > run on this Mac. (Mac Pro, fairly recent, Xeon, tons of RAM, almost > non-existent CPU load). Anybody have any idea wtf that''s about??? > > I''ve just hard-coded the time zone default and it''s fine. But still, > just wondering if anybody has a clue?You don''t happen to have "Set timezone automatically using current location" checked in your "Date & Time" system preference? I have no idea if this would cause the problem you''re seeing, but it''s the first thing that came to mind when I saw this. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Jan 11, 2013, at 8:33 AM, Robert Walker wrote:> You don''t happen to have "Set timezone automatically using current > location" checked in your "Date & Time" system preference?No, I have it set to a fixed location. I tried changing the location, and I tried a different NTP server as well. Neither changed anything. Later I tried other systemsetup commands, and hell, systemsetup always takes 30 seconds, even without a command just to get into it''s "console" mode takes > 30 seconds to launch. I wonder if it''s doing some reverse DNS thing at launch??? -- Scott Ribe scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
config.time_zone = Time.zone || "UTC" is what you are looking for. The Time.zone command looks into the local time zone set for the user visiting your current page and returns it, if not found it will return the UTC Time zone. In your case looking up the timezone of the server it is running on since its a config. No need to grab it like this because ruby can do it by itself. However, if you want to give users access to their local time zones you should go with an time_zone_select field in user registration and an application_controller before filter, something like this: before_filter :settimezone def settimezone Time.zone = user.timezone || "UTC" (well, change that to whatever, but you get the point) end Hope this can help you. Sincerly, Crispin Am Freitag, 11. Januar 2013 05:54:37 UTC+1 schrieb Scott Ribe:> > I deployed an app to an OS X (10.6.8) server, and launch time for the app > was shockingly slow, but performance after launch was fine. > > The problem turns out to be this line in application.rb: > > config.time_zone = /Time Zone: (.*)$/.match(`systemsetup -gettimezone`)[1] > > Yes, that''s right, systemsetup -gettimezone takes a full 30 seconds to run > on this Mac. (Mac Pro, fairly recent, Xeon, tons of RAM, almost > non-existent CPU load). Anybody have any idea wtf that''s about??? > > I''ve just hard-coded the time zone default and it''s fine. But still, just > wondering if anybody has a clue? > > -- > Scott Ribe > scott...-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org <javascript:> > http://www.elevated-dev.com/ > (303) 722-0567 voice > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ot3nhW_rKvMJ. For more options, visit https://groups.google.com/groups/opt_out.