[PATCH] F-spot: Allow dates before 1970
- From: Fredrik Noring <noring nocrew org>
- To: Larry Ewing <lewing novell com>
- Cc: F-spot-list <f-spot-list gnome org>
- Subject: [PATCH] F-spot: Allow dates before 1970
- Date: Sun, 10 Jul 2005 21:43:06 +0200
Hi Larry
Attached is my second patch that tries to address a problem with photos
dated before 1970. This version implements negative unix time integers
so that old databases will remain compatible with the patch applied.
Db.cs | 6 +++---
ImportStore.cs | 4 ++--
PhotoStore.cs | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
Please consider applying it in some form.
Thanks,
Fredrik
--- f-spot-0.0.13.orig/src/Db.cs 2005-02-14 07:15:00.000000000 +0100
+++ f-spot-0.0.13.new/src/Db.cs 2005-07-10 21:13:40.000000000 +0200
@@ -168,14 +168,14 @@
public class DbUtils {
- public static DateTime DateTimeFromUnixTime (uint unix_time)
+ public static DateTime DateTimeFromUnixTime (long unix_time)
{
DateTime date_time = new DateTime (1970, 1, 1).ToLocalTime ();
return date_time.AddSeconds (unix_time);
}
- public static uint UnixTimeFromDateTime (DateTime date_time)
+ public static long UnixTimeFromDateTime (DateTime date_time)
{
- return (uint) (date_time - new DateTime (1970, 1, 1).ToLocalTime ()).TotalSeconds;
+ return (long) (date_time - new DateTime (1970, 1, 1).ToLocalTime ()).TotalSeconds;
}
}
--- f-spot-0.0.13.orig/src/ImportStore.cs 2003-11-22 19:47:20.000000000 +0100
+++ f-spot-0.0.13.new/src/ImportStore.cs 2005-07-10 21:13:07.000000000 +0200
@@ -15,7 +15,7 @@
}
}
- public Import (uint id, uint unix_time)
+ public Import (uint id, long unix_time)
: base (id)
{
time = DbUtils.DateTimeFromUnixTime (unix_time);
@@ -51,7 +51,7 @@
public Import Create (DateTime time_in_utc)
{
- uint unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc);
+ long unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc);
SqliteCommand command = new SqliteCommand ();
command.Connection = Connection;
--- f-spot-0.0.13.orig/src/PhotoStore.cs 2005-05-09 07:52:29.000000000 +0200
+++ f-spot-0.0.13.new/src/PhotoStore.cs 2005-07-10 21:14:45.000000000 +0200
@@ -361,7 +361,7 @@
// Constructor
- public Photo (uint id, uint unix_time, string directory_path, string name)
+ public Photo (uint id, long unix_time, string directory_path, string name)
: base (id)
{
time = DbUtils.DateTimeFromUnixTime (unix_time);
@@ -376,7 +376,7 @@
AddVersionUnsafely (OriginalVersionId, "Original");
}
- public Photo (uint id, uint unix_time, string path)
+ public Photo (uint id, long unix_time, string path)
: this (id, unix_time,
System.IO.Path.GetDirectoryName (path),
System.IO.Path.GetFileName (path))
@@ -517,7 +517,7 @@
throw new Exception ("Only jpeg files supported");
- uint unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc);
+ long unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc);
SqliteCommand command = new SqliteCommand ();
command.Connection = Connection;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]