[f-spot] Don't convert photo times to UTC.



commit bc60bffb8d564a232e9928d987d27e371458d79f
Author: Paul Werner Bou <paul purecodes org>
Date:   Fri May 14 20:46:49 2010 +0200

    Don't convert photo times to UTC.
    
    Changes the default to never touch photo timestamps.
    
    Fixes BGO #340903  - Adjust Time: Changing internal photo time to UTC is
    not good
    
    Signed-off-by: Ruben Vermeersch <ruben savanne be>

 extensions/Tools/MergeDb/MergeDbDialog.cs |    1 +
 src/Imaging/Ciff.cs                       |    2 +-
 src/Imaging/ImageFile.cs                  |    2 +-
 src/Imaging/JpegFile.cs                   |    6 +++---
 src/Imaging/MrwFile.cs                    |    2 +-
 src/Imaging/PngFile.cs                    |    2 +-
 src/Imaging/Tiff.cs                       |    4 ++--
 src/Jobs/SyncMetadataJob.cs               |    2 +-
 src/UI.Dialog/AdjustTimeDialog.cs         |    2 +-
 src/UI.Dialog/LastRollDialog.cs           |    1 +
 src/Utils/DbUtils.cs                      |    8 ++++----
 src/Widgets/IconView.cs                   |    4 ++--
 src/Widgets/InfoBox.cs                    |   14 +++++++-------
 13 files changed, 26 insertions(+), 24 deletions(-)
---
diff --git a/extensions/Tools/MergeDb/MergeDbDialog.cs b/extensions/Tools/MergeDb/MergeDbDialog.cs
index d59e810..7efbf2d 100644
--- a/extensions/Tools/MergeDb/MergeDbDialog.cs
+++ b/extensions/Tools/MergeDb/MergeDbDialog.cs
@@ -62,6 +62,7 @@ namespace MergeDbExtension
 				rolls = value;
 				foreach (Roll r in rolls) {
 					uint numphotos = parent.FromDb.Rolls.PhotosInRoll (r);
+					// Roll time is in UTC always
 					DateTime date = r.Time.ToLocalTime ();
 					rolls_combo.AppendText (String.Format ("{0} ({1})", date.ToString("%dd %MMM, %HH:%mm"), numphotos));
 					rolls_combo.Active = 0;
diff --git a/src/Imaging/Ciff.cs b/src/Imaging/Ciff.cs
index b59605f..34c6071 100644
--- a/src/Imaging/Ciff.cs
+++ b/src/Imaging/Ciff.cs
@@ -441,7 +441,7 @@ namespace FSpot.Ciff {
 					return base.Date;
 				}
 
-				return new CaptureTime (date, little).LocalTime.ToUniversalTime ();
+				return new CaptureTime (date, little).LocalTime;
 			}
 		}
 
diff --git a/src/Imaging/ImageFile.cs b/src/Imaging/ImageFile.cs
index 8f7d123..5676fba 100644
--- a/src/Imaging/ImageFile.cs
+++ b/src/Imaging/ImageFile.cs
@@ -206,7 +206,7 @@ namespace FSpot {
 
 			return t;
 		}
-
+		
 		[Obsolete ("use Create (System.Uri) instead")]
 		public static ImageFile Create (string path)
 		{
diff --git a/src/Imaging/JpegFile.cs b/src/Imaging/JpegFile.cs
index ff17905..c82e6dc 100644
--- a/src/Imaging/JpegFile.cs
+++ b/src/Imaging/JpegFile.cs
@@ -333,13 +333,13 @@ Console.WriteLine ("<<<");
 						e = sub.Directory [0].Lookup (TagId.DateTimeOriginal);
 						
 						if (e != null)
-							return DirectoryEntry.DateTimeFromString (e.StringValue).ToUniversalTime ();
+							return DirectoryEntry.DateTimeFromString (e.StringValue);
 					}
 					
 					e = ExifHeader.Directory.Lookup (TagId.DateTime);
 					
 					if (e != null)
-						return DirectoryEntry.DateTimeFromString (e.StringValue).ToUniversalTime ();
+						return DirectoryEntry.DateTimeFromString (e.StringValue);
 					
 					return base.Date;
 #else
@@ -349,7 +349,7 @@ Console.WriteLine ("<<<");
 					if (time_str == null || time_str == "") 
 						time_str = ExifData.LookupFirstValue (Exif.Tag.DateTime);
 					
-					time = Exif.ExifUtil.DateTimeFromString (time_str).ToUniversalTime (); 
+					time = Exif.ExifUtil.DateTimeFromString (time_str); 
 #endif
 				} catch (System.Exception e) {
 					Console.WriteLine (e);
diff --git a/src/Imaging/MrwFile.cs b/src/Imaging/MrwFile.cs
index 098c72e..b4693df 100644
--- a/src/Imaging/MrwFile.cs
+++ b/src/Imaging/MrwFile.cs
@@ -201,7 +201,7 @@ namespace FSpot.Mrw {
 				DirectoryEntry e = this.Header.Directory.Lookup (TagId.DateTime);
 				
 				if (e != null)
-					return DirectoryEntry.DateTimeFromString (e.StringValue).ToUniversalTime ();
+					return DirectoryEntry.DateTimeFromString (e.StringValue);
 				else
 					return base.Date;
 			}
diff --git a/src/Imaging/PngFile.cs b/src/Imaging/PngFile.cs
index 8601a5a..cccf6e6 100644
--- a/src/Imaging/PngFile.cs
+++ b/src/Imaging/PngFile.cs
@@ -1418,7 +1418,7 @@ namespace FSpot.Png {
 				foreach (Chunk chunk in Chunks) {
 					TimeChunk time = chunk as TimeChunk;
 					if (time != null)
-						return time.Time.ToUniversalTime ();
+						return time.Time;
 				}
 				return base.Date;
 			}
diff --git a/src/Imaging/Tiff.cs b/src/Imaging/Tiff.cs
index 4dc86c2..083e13e 100644
--- a/src/Imaging/Tiff.cs
+++ b/src/Imaging/Tiff.cs
@@ -2066,13 +2066,13 @@ namespace FSpot.Tiff {
 					e = sub.Directory [0].Lookup (TagId.DateTimeOriginal);
 					
 					if (e != null)
-						return DirectoryEntry.DateTimeFromString (e.StringValue).ToUniversalTime ();
+						return DirectoryEntry.DateTimeFromString (e.StringValue);
 				}
 
 				e = this.Header.Directory.Lookup (TagId.DateTime);
 
 				if (e != null)
-					return DirectoryEntry.DateTimeFromString (e.StringValue).ToUniversalTime ();
+					return DirectoryEntry.DateTimeFromString (e.StringValue);
 				else
 					return base.Date;
 			}
diff --git a/src/Jobs/SyncMetadataJob.cs b/src/Jobs/SyncMetadataJob.cs
index 76825b0..b0ceadd 100644
--- a/src/Jobs/SyncMetadataJob.cs
+++ b/src/Jobs/SyncMetadataJob.cs
@@ -53,7 +53,7 @@ namespace FSpot.Jobs {
 					FSpot.JpegFile jimg = img as FSpot.JpegFile;
 				
 					jimg.SetDescription (photo.Description);
-					jimg.SetDateTimeOriginal (photo.Time.ToLocalTime ());
+					jimg.SetDateTimeOriginal (photo.Time);
 					jimg.SetXmp (UpdateXmp (photo, jimg.Header.GetXmp ()));
 	
 					jimg.SaveMetaData (path);
diff --git a/src/UI.Dialog/AdjustTimeDialog.cs b/src/UI.Dialog/AdjustTimeDialog.cs
index 31b61e6..bf34919 100644
--- a/src/UI.Dialog/AdjustTimeDialog.cs
+++ b/src/UI.Dialog/AdjustTimeDialog.cs
@@ -122,7 +122,7 @@ namespace FSpot.UI.Dialog {
 				IBrowsableItem item = Item.Current;
 				
 				name_label.Text = System.Uri.UnescapeDataString(item.Name);
-				old_label.Text = item.Time.ToLocalTime ().ToString ();
+				old_label.Text = (item.Time).ToString ();
 				
 				int i = collection.Count > 0 ? Item.Index + 1: 0;
 				// Note for translators: This indicates the current photo is photo {0} of {1} out of photos
diff --git a/src/UI.Dialog/LastRollDialog.cs b/src/UI.Dialog/LastRollDialog.cs
index e34f58f..1e83c6c 100644
--- a/src/UI.Dialog/LastRollDialog.cs
+++ b/src/UI.Dialog/LastRollDialog.cs
@@ -86,6 +86,7 @@ namespace FSpot.UI.Dialog {
 			for (uint k = 0; k < rolls.Length; k++)
 			{
 				uint numphotos = rollstore.PhotosInRoll (rolls [k]);
+				// Roll time is in UTC always
 				DateTime date = rolls [k].Time.ToLocalTime ();
 				
 				string header = String.Format ("{0} ({1})",
diff --git a/src/Utils/DbUtils.cs b/src/Utils/DbUtils.cs
index 1e5cd2e..2de5205 100644
--- a/src/Utils/DbUtils.cs
+++ b/src/Utils/DbUtils.cs
@@ -17,23 +17,23 @@ namespace FSpot.Utils
 		public static DateTime DateTimeFromUnixTime (long unix_time)
 		{
 			DateTime date_time = new DateTime (1970, 1, 1);
-			return date_time.AddSeconds (unix_time).ToLocalTime ();
+			return date_time.AddSeconds (unix_time);
 		}
 	
 		public static long UnixTimeFromDateTime (DateTime date_time)
 		{
-			return (long) (date_time.ToUniversalTime () - new DateTime (1970, 1, 1)).TotalSeconds;
+			return (long) (date_time - new DateTime (1970, 1, 1)).TotalSeconds;
 		}
 #else
 		public static DateTime DateTimeFromUnixTime (long unix_time)
 		{
-			DateTime date_time = new DateTime (1970, 1, 1).ToLocalTime ();
+			DateTime date_time = new DateTime (1970, 1, 1);
 			return date_time.AddSeconds (unix_time);
 		}
 		
 		public static long UnixTimeFromDateTime (DateTime date_time)
 		{
-			return (long) (date_time - new DateTime (1970, 1, 1).ToLocalTime ()).TotalSeconds;
+			return (long) (date_time - new DateTime (1970, 1, 1)).TotalSeconds;
 		}
 #endif
 	}
diff --git a/src/Widgets/IconView.cs b/src/Widgets/IconView.cs
index 3d1a976..2874e3a 100644
--- a/src/Widgets/IconView.cs
+++ b/src/Widgets/IconView.cs
@@ -902,9 +902,9 @@ namespace FSpot.Widgets
 			if (DisplayDates) {
 				string date;
 				if (cell_width > 200) {
-					date = photo.Time.ToLocalTime ().ToString ();
+					date = photo.Time.ToString ();
 				} else {
-					date = photo.Time.ToLocalTime ().ToShortDateString ();
+					date = photo.Time.ToShortDateString ();
 				}
 
 				Pango.Layout layout = (Pango.Layout)date_layouts [date];
diff --git a/src/Widgets/InfoBox.cs b/src/Widgets/InfoBox.cs
index 116590e..afac668 100644
--- a/src/Widgets/InfoBox.cs
+++ b/src/Widgets/InfoBox.cs
@@ -338,7 +338,7 @@ namespace FSpot.Widgets
 					height = real_height.ToString ();
 				}
 	#if USE_EXIF_DATE
-				date = img.Date.ToLocalTime ();
+				date = img.Date;
 	#endif
 			}
 	
@@ -522,7 +522,7 @@ namespace FSpot.Widgets
 	#if USE_EXIF_DATE
 				date_value_label.Text = info.Date;
 	#else
-				DateTime local_time = photo.Time.ToLocalTime ();
+				DateTime local_time = photo.Time;
 				date_value_label.Text = String.Format ("{0}{2}{1}",
 				                                       local_time.ToShortDateString (),
 				                                       local_time.ToShortTimeString (),
@@ -638,13 +638,13 @@ namespace FSpot.Widgets
 				if (first.Time.Date == last.Time.Date) {
 					//Note for translators: {0} is a date, {1} and {2} are times.
 					date_value_label.Text = String.Format(Catalog.GetString("On {0} between \n{1} and {2}"), 
-					                                      first.Time.ToLocalTime ().ToShortDateString (),
-					                                      first.Time.ToLocalTime ().ToShortTimeString (),
-					                                      last.Time.ToLocalTime ().ToShortTimeString ());
+					                                      first.Time.ToShortDateString (),
+					                                      first.Time.ToShortTimeString (),
+					                                      last.Time.ToShortTimeString ());
 				} else {
 					date_value_label.Text = String.Format(Catalog.GetString("Between {0} \nand {1}"),
-					                                      first.Time.ToLocalTime ().ToShortDateString (),
-					                                      last.Time.ToLocalTime ().ToShortDateString ());
+					                                      first.Time.ToShortDateString (),
+					                                      last.Time.ToShortDateString ());
 				}
 			}
 			date_label.Visible = show_date;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]