From: Richard W.M. Jones Date: Fri, 29 Jul 2011 18:53:19 +0000 (+0100) Subject: Use the Calendar module. X-Git-Tag: 0.2.1~3 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=e74131b3a055fe3f3333030d8459275436f37a40;p=guestfs-browser.git Use the Calendar module. --- diff --git a/Makefile.am b/Makefile.am index ac197c4..dbb23a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -121,7 +121,7 @@ XOBJECTS = $(OBJECTS:.cmo=.cmx) bin_SCRIPTS = guestfs-browser OCAMLPACKAGES = \ - -package libvirt,guestfs,hivex,lablgtk2,extlib,xml-light,camomile,threads,bitstring,bitstring.syntax -syntax bitstring + -package libvirt,guestfs,hivex,lablgtk2,extlib,xml-light,calendar,camomile,threads,bitstring,bitstring.syntax -syntax bitstring OCAMLCFLAGS = \ -g \ -warn-error CDEFLMPSUVYZX \ diff --git a/configure.ac b/configure.ac index 3a0b364..722832d 100644 --- a/configure.ac +++ b/configure.ac @@ -78,6 +78,11 @@ if test "$OCAML_PKG_xml_light" = "no"; then AC_MSG_ERROR([Please install OCaml module 'xml-light'.]) fi +AC_CHECK_OCAML_PKG([calendar]) +if test "$OCAML_PKG_calendar" = "no"; then + AC_MSG_ERROR([Please install OCaml module 'calendar'.]) +fi + AC_CHECK_OCAML_PKG([camomile]) if test "$OCAML_PKG_camomile" = "no"; then AC_MSG_ERROR([Please install OCaml module 'camomile' (>= 0.8, including the data module if that is separate).]) diff --git a/filetree_markup.ml b/filetree_markup.ml index b5728fa..84c4288 100644 --- a/filetree_markup.ml +++ b/filetree_markup.ml @@ -25,6 +25,8 @@ open Slave_types open Printf +module CL = CalendarLib + (* Base colours. XXX Should be configurable somewhere. *) let file_color = 0x20, 0x20, 0xff (* regular file *) let dir_color = 0x80, 0x80, 0x20 (* directory *) @@ -149,10 +151,10 @@ let markup_of_date t = let t = Int64.to_float t in let show_full_date () = - let tm = localtime t in - sprintf "%04d-%02d-%02d %02d:%02d:%02d" - (tm.tm_year + 1900) (tm.tm_mon + 1) tm.tm_mday - tm.tm_hour tm.tm_min tm.tm_sec + let cal = CL.Calendar.from_unixfloat t in + let cal = CL.Calendar.convert cal CL.Time_Zone.UTC CL.Time_Zone.Local in + CL.Printer.Calendar.sprint + "%F %T" cal in (* How long ago? *)