Renamed age.c/h to date.c/h
authorChristian Thaeter <ct@pipapo.org>
Thu, 7 Feb 2008 05:38:55 +0000 (06:38 +0100)
committerChristian Thaeter <ct@pipapo.org>
Thu, 7 Feb 2008 05:38:55 +0000 (06:38 +0100)
Added function to pretty-print dates, more coming soon

Makefile.am
src/actions.c
src/branch.c
src/date.c [moved from src/age.c with 87% similarity]
src/date.h [moved from src/age.h with 96% similarity]
src/repo.c
src/tag.c

index 1071487..0bb10e7 100644 (file)
@@ -41,7 +41,7 @@ webgit_SOURCES =                              \
        $(webgit_srcdir)/options.c              \
        $(webgit_srcdir)/query.c                \
        $(webgit_srcdir)/actions.c              \
-       $(webgit_srcdir)/age.c                  \
+       $(webgit_srcdir)/date.c                 \
        $(webgit_srcdir)/summary.c              \
        $(webgit_srcdir)/repo.c                 \
        $(webgit_srcdir)/object.c               \
@@ -61,7 +61,7 @@ noinst_HEADERS =                              \
        $(webgit_srcdir)/options.h              \
        $(webgit_srcdir)/query.h                \
        $(webgit_srcdir)/actions.h              \
-       $(webgit_srcdir)/age.h                  \
+       $(webgit_srcdir)/date.h                 \
        $(webgit_srcdir)/summary.h              \
        $(webgit_srcdir)/repo.h                 \
        $(webgit_srcdir)/object.h               \
index 19ada57..f216970 100644 (file)
@@ -24,7 +24,7 @@
 #include "object.h"
 #include "log.h"
 #include "repo.h"
-#include "age.h"
+#include "date.h"
 #include "branch.h"
 #include "tag.h"
 #include "account.h"
index de70617..2a619bb 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "branch.h"
 #include "object.h"
-#include "age.h"
+#include "date.h"
 #include "log.h"
 
 #include <cwa.h>
similarity index 87%
rename from src/age.c
rename to src/date.c
index f9343e8..9404454 100644 (file)
--- a/src/age.c
@@ -18,7 +18,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "age.h"
+#include "date.h"
 
 #include <time.h>
 
@@ -47,6 +47,17 @@ webgit_pretty_age (unsigned long age)
     return html_fmt("%d years ago", age / (60 * 60 * 24 * 365));
 }
 
+Html
+webgit_pretty_date (time_t time)
+{
+  struct tm* tm = gmtime (&time);
+
+  char* pretty_date = cwa_buffer_provide (256);
+  strftime (pretty_date, 255, "%c", tm);
+  return html_strndup (pretty_date, 255);
+}
+
+
 /*
 //      Local Variables:
 //      mode: C
similarity index 96%
rename from src/age.h
rename to src/date.h
index e0580aa..20ab95f 100644 (file)
--- a/src/age.h
@@ -25,6 +25,8 @@
 Html
 webgit_pretty_age (unsigned long age);
 
+Html
+webgit_pretty_date (time_t time);
 
 #endif
 
index 98a672e..e255e98 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 #include "repo.h"
-#include "age.h"
+#include "date.h"
 
 #define SHA1_HEADER <openssl/sha.h>
 #include "git/cache.h"
index 9bdfd0e..61188e7 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -20,7 +20,7 @@
 
 #include "tag.h"
 #include "object.h"
-#include "age.h"
+#include "date.h"
 #include "log.h"
 
 #include <cwa.h>