Fix bug 769938 - calDateTime returns invalid nativeTime property with dates before 1970. r=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Tue, 10 Jul 2012 14:20:19 +0200
changeset 12831 af45c977d51710554bcba7bde8e4f18c40c9ba8f
parent 12830 24962325fc6ead602eecbc96a5b49d074d135524
child 12832 105f391d603dfca47e9cf9f4596e10cda9086525
push idunknown
push userunknown
push dateunknown
reviewersphilipp
bugs769938
Fix bug 769938 - calDateTime returns invalid nativeTime property with dates before 1970. r=philipp
calendar/base/public/calIDateTime.idl
calendar/base/src/calDateTime.cpp
--- a/calendar/base/public/calIDateTime.idl
+++ b/calendar/base/public/calIDateTime.idl
@@ -46,17 +46,17 @@ interface calIDateTime : nsISupports
    * @warning: When the timezone is set to 'floating', this will return
    * the nativeTime as-if the timezone was UTC. Take this into account
    * when comparing values.
    *
    * @note on objects that are pinned to a timezone and have isDate set,
    * nativeTime will be 00:00:00 in the timezone of that date, not 00:00:00 in
    * UTC.
    */
-  attribute PRTime nativeTime;
+  attribute PRInt64 nativeTime;
 
   /**
    * Full 4-digit year value (e.g. "1989", "2004")
    */
   attribute short year;
 
   /**
    * Month, 0-11, 0 = January
--- a/calendar/base/src/calDateTime.cpp
+++ b/calendar/base/src/calDateTime.cpp
@@ -204,19 +204,19 @@ calDateTime::ToString(nsACString & aResu
 {
     nsCAutoString tzid;
     char buffer[256];
 
     ensureTimezone();
     mTimezone->GetTzid(tzid);
 
     PRUint32 const length = PR_snprintf(
-        buffer, sizeof(buffer), "%04hd/%02hd/%02hd %02hd:%02hd:%02hd %s isDate=%01hd",
+        buffer, sizeof(buffer), "%04hd/%02hd/%02hd %02hd:%02hd:%02hd %s isDate=%01hd nativeTime=%lld",
         mYear, mMonth + 1, mDay, mHour, mMinute, mSecond,
-        tzid.get(), static_cast<PRInt16>(mIsDate));
+        tzid.get(), static_cast<PRInt16>(mIsDate), mNativeTime);
     if (length != static_cast<PRUint32>(-1))
         aResult.Assign(buffer, length);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calDateTime::SetTimeInTimezone(PRTime aTime, calITimezone * aTimezone)
 {