Fix for Lion: calculating the local time for force_install_after_date

git-svn-id: http://munki.googlecode.com/svn/trunk@1292 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2011-08-15 15:51:16 +00:00
parent d8f947e0d1
commit 92eed69394
+3 -1
View File
@@ -227,8 +227,10 @@ def discardTimeZoneFromDate(the_date):
"""Input: NSDate object
Output: NSDate object with same date and time as the UTC.
In PDT, '2011-06-20T12:00:00Z' becomes '2011-06-20 12:00:00 -0700'"""
# Convert to string representation in local time zone
date_str = the_date.descriptionWithCalendarFormat_timeZone_locale_(None, None, None)
# get local offset
(unused_date, unused_time, offset) = str(the_date).split()
(unused_date, unused_time, offset) = date_str.split()
hour_offset = int(offset[0:3])
minute_offset = int(offset[0] + offset[3:])
seconds_offset = 60 * 60 * hour_offset + 60 * minute_offset