{"thread":{"id":"15378","subject":"[JGIT PATCH] Expose the raw timezone offset from PersonIdent","startedAt":"2008-09-05T01:37:19Z","lastAt":"2008-09-06T19:27:27Z","messageCount":3,"participants":["Shawn O. Pearce","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"89818","messageId":"1220578639-11723-1-git-send-email-spearce@spearce.org","threadId":"15378","inReplyTo":null,"subject":"[JGIT PATCH] Expose the raw timezone offset from PersonIdent","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-05T01:37:19Z","receivedAt":"2008-09-05T01:37:19Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Applications may wish to have this value, much as they\ncan get the raw seconds-since-epoch and reformat it\nfor their own uses.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../src/org/spearce/jgit/lib/PersonIdent.java      |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\nindex 5e524d3..bc5479a 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\n@@ -260,6 +260,14 @@ public TimeZone getTimeZone() {\n \t\treturn TimeZone.getTimeZone(ids[0]);\n \t}\n \n+\t/**\n+\t * @return this person's preferred time zone as minutes east of UTC. If the\n+\t *         timezone is to the west of UTC it is negative.\n+\t */\n+\tpublic int getTimeZoneOffset() {\n+\t\treturn tzOffset;\n+\t}\n+\n \tpublic int hashCode() {\n \t\treturn getEmailAddress().hashCode() ^ (int) when;\n \t}\n-- \n1.6.0.1.319.g9f32b\n"},{"id":"89907","messageId":"200809061705.56879.robin.rosenberg.lists@dewire.com","threadId":"15378","inReplyTo":"1220578639-11723-1-git-send-email-spearce@spearce.org","subject":"Re: [JGIT PATCH] Expose the raw timezone offset from PersonIdent","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-09-06T15:05:56Z","receivedAt":"2008-09-06T15:05:56Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"fredagen den 5 september 2008 03.37.19 skrev Shawn O. Pearce:\n> Applications may wish to have this value, much as they\n> can get the raw seconds-since-epoch and reformat it\n> for their own uses.\n\nNecessary (performance) or just nice? We already provide the\ntimezone in java.util format.\n\n-- robin\n"},{"id":"89926","messageId":"20080906192727.GC18631@spearce.org","threadId":"15378","inReplyTo":"200809061705.56879.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH] Expose the raw timezone offset from PersonIdent","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-06T19:27:27Z","receivedAt":"2008-09-06T19:27:27Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> fredagen den 5 september 2008 03.37.19 skrev Shawn O. Pearce:\n> > Applications may wish to have this value, much as they\n> > can get the raw seconds-since-epoch and reformat it\n> > for their own uses.\n> \n> Necessary (performance) or just nice? We already provide the\n> timezone in java.util format.\n\nIt isn't necessary from a performance perspective, but is required\nto read the commit data exactly, but in parsed form.\n\nWhat I'm doing at the application level is taking a RevCommit and\nconverting it into a different data structure (more specifically\na Google Protocol Buffer) that has all of the parts broken out.\nIt looks like this:\n\n  message GitPerson {\n    required string name = 1;\n    required string email = 2;\n    required int32 when = 3;\n    required int32 tz = 4;\n  }\n  \n  message GitCommit {\n    required string id = 1;\n    repeated string parent_id = 2;\n    required GitPerson author = 3;\n    optional GitPerson committer = 4;\n    optional string message = 5;\n  }\n\nI'm later processing the GitPerson in Python and need to use the tz\nto offset when to format a time for display.  If the author has a\n\"funny\" offset in their commit our existing getTimeZone() method\ncan return null, which means I have to then lie and send 0 to the\nPython code.  I'd rather send the exact offset.\n\n-- \nShawn.\n"}]}