 _array = (t) ->
   return tz(t, "%Y %m %d %H %M %S").split(/\s+/).map( (e) -> return parseInt(e, 10) );
 
+_strftime = (t, format) ->
+  if _.isFunction(format)
+    return format(t)
+  else
+    return tz(t, format)
+
 class DatetimeFormatter
 
   # Labels of time units, from finest to coarsest.

      'hours':        ['%Hh', '%H:%M']
      'days':         ['%m/%d', '%a%d']
      'months':       ['%m/%Y', '%b%y']
      'years':        ['%Y'] #[_two_digit_year, _four_digit_year]
    }
    @formats = {}
    for fmt_name of @_formats
      fmt_strings = @_formats[fmt_name]
      sizes = []
      tmptime = tz(new Date())
      for s in fmt_strings
          size = (tz(tmptime, s)).length
          sizes.push(size)
      @formats[fmt_name] = [sizes, fmt_strings]
    return


    return labels

_us = (t) ->
  return sprintf("%3dus", Math.floor((t % 1) * 1000))

_ms_dot_us = (t) ->
  ms = Math.floor(((t / 1000) % 1) * 1000)
  us = Math.floor((t % 1) * 1000)
  return sprintf("%3d.%3dms", ms, us)


_two_digit_year = (t) ->
  # Round to the nearest Jan 1, roughly.
  dt = new Date(t)
  year = dt.getFullYear()
  if dt.getMonth() >= 7
      year += 1
