summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorBen Straub <bstraub@github.com>2012-05-10 09:47:14 -0700
committerBen Straub <bstraub@github.com>2012-05-11 11:35:50 -0700
commita346992f7e7812416651eb5c2b52129adec5eacf (patch)
tree6d09141890c8d1c7e1535527ee94187fccd2afc0 /src/util.h
parent886f183ac3dc43c774700825ba32b7b6ffbfc3c3 (diff)
downloadlibgit2-a346992f7e7812416651eb5c2b52129adec5eacf.tar.gz
Rev-parse: @{time} syntax.
Ported date.c (for approxidate_careful) from git.git revision aa39b85. Trimmed out the parts we're not using.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 2081f29f9..4d1ee680d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -209,4 +209,11 @@ GIT_INLINE(bool) git__isspace(int c)
return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v');
}
+GIT_INLINE(int) git__time_cmp(const git_time *a, const git_time *b)
+{
+ /* Adjust for time zones. Times are in seconds, offsets are in minutes. */
+ git_time_t adjusted_a = a->time + ((b->offset - a->offset) * 60);
+ return adjusted_a - b->time;
+}
+
#endif /* INCLUDE_util_h__ */