Calendar get local time zone.

Configuration userConfig = new Configuration();
Settings.System.getConfiguration( getContentResolver(), userConfig );
Calendar cal = Calendar.getInstance( userConfig.locale);
TimeZone tz = cal.getTimeZone();

when the user changes the time zone in the Settings app then the above will get the
newly updated value.

that wasn't obvious, wasn't it?


    /**
     * Calcuate if it's currently "daytime" by our internal definition. Used to
     * decide which icons to show when updating widgets.
     */
    public static boolean isDaytime() {
        Time time = new Time();
        time.setToNow();
        return (time.hour >= DAYTIME_BEGIN_HOUR && time.hour <= DAYTIME_END_HOUR);
    }

你可能感兴趣的:(calendar)