diff --git a/kernel/core/moment.rb b/kernel/core/moment.rb
index 6f16098..6493a8a 100644
--- a/kernel/core/moment.rb
+++ b/kernel/core/moment.rb
@@ -3,6 +3,33 @@

class Moment

+ def self.system_timezone
+ @system_timezone ||= begin
+ zone = "UTC"
+ setting = "/etc/localtime"
+ if ENV['TZ']
+ zone = ENV['TZ']
+ elsif File.exist?(setting)
+ if File.symlink?(setting)
+ file = File.readlink(setting)
+ zone = file.match(/zoneinfo\/(.*)/)[1]
+ else
+ path = ENV['TZDEFAULT'] || "/usr/share/zoneinfo"
+ data = File.new("/etc/localtime").gets
+ Dir.glob("#{path}/**/*").each do |file|
+ if File.file?(file) &&
+ File.size("/etc/localtime") == File.size(file) &&
+ data == File.new(file).gets
+ zone = file.match(/#{path}\/(.*)/)[1]
+ break
+ end
+ end
+ end
+ end
+ zone
+ end
+ end
+
def self.now
Moment.new(nil)
end