From cc54dadd2bc41f9fb4698985f8c00dfeec81f7cf Mon Sep 17 00:00:00 2001 From: "vladimir%pobox.com" Date: Fri, 10 Dec 2004 01:35:48 +0000 Subject: [PATCH] fix calDateTime jsDate conversion, oops; notpartofthebuild --- calendar/base/src/calDateTime.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/calendar/base/src/calDateTime.cpp b/calendar/base/src/calDateTime.cpp index fcf24ed6331..3af54d6abde 100644 --- a/calendar/base/src/calDateTime.cpp +++ b/calendar/base/src/calDateTime.cpp @@ -148,13 +148,7 @@ calDateTime::GetNativeTime(PRTime *aResult) NS_IMETHODIMP calDateTime::SetNativeTime(PRTime aNativeTime) { - if (mIsUtc) { - return SetTimeInTimezone (aNativeTime, "UTC"); - } else if (!mTimezone.IsEmpty()) { - return SetTimeInTimezone (aNativeTime, mTimezone.get()); - } else { - return SetTimeInTimezone (aNativeTime, NULL); - } + return SetTimeInTimezone (aNativeTime, NULL); } NS_IMETHODIMP @@ -216,9 +210,13 @@ calDateTime::SetTimeInTimezone(PRTime aTime, const char *aTimezone) struct icaltimetype icalt; time_t tt; - icaltimezone *zone = icaltimezone_get_builtin_timezone_from_tzid(aTimezone); - if (!zone) - return NS_ERROR_FAILURE; + icaltimezone *zone = nsnull; + + if (aTimezone) { + icaltimezone *zone = icaltimezone_get_builtin_timezone_from_tzid(aTimezone); + if (!zone) + return NS_ERROR_FAILURE; + } PRInt64 temp, million; LL_I2L(million, PR_USEC_PER_SEC); @@ -227,7 +225,11 @@ calDateTime::SetTimeInTimezone(PRTime aTime, const char *aTimezone) LL_L2I(sectime, temp); tt = sectime; - icalt = icaltime_from_timet_with_zone(tt, 0, zone); + if (zone) { + icalt = icaltime_from_timet_with_zone(tt, 0, zone); + } else { + icalt = icaltime_from_timet(tt, 0); + } FromIcalTime(&icalt); return NS_OK; @@ -331,9 +333,6 @@ calDateTime::FromIcalTime(icaltimetype *icalt) mIsUtc = icalt->is_utc ? PR_TRUE : PR_FALSE; mIsDate = icalt->is_date ? PR_TRUE : PR_FALSE; - mTimezoneOffset = 0; - mTimezone.Assign(""); - // reconstruct nativetime time_t tt = icaltime_as_timet(*icalt); PRInt64 temp, million;