View Single Post
Old 03-17-2013, 12:38 PM   #3
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Time formatting in title bar is handled completely by JavaScript code at /usr/share/webkit-.0/pillow/javascripts/default_status_bar.js. It relies on (non-standard?) DateTimeFormat object accessible from JavaScript and provided by Kindle's WebKitGTK library. Object constructor has following signature:
Code:
/**
 * Creates an instance of DateTimeFormat object.
 *
 * @constructor
 *
 * @param {string} format Datetime format (at least, "short-time" is recognized).
 * @param {string=} timeZone Optional time zone for converting current time (at least, "GMT" is recognized).
 */
function DateTimeFormat(format, timeZone) { /* ... */ }
Formatting code uses format method of this object, which expects standard JavaScript Date object as parameter.

I believe, DateTimeFormat object forwards formatting requests to ICU library object created by DateFormat::createDateTimeInstance function.

It's possible to change time format independently of current locale with runtime replacing of DateTimeFormat object by executing following command:
Code:
lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "DateTimeFormatter = {\"format\": function(date){return date.getHours()+\":\"+date.getMinutes();}}; StatusBar.clock.update();"}'
(It will change time format to 24-hour and will work only until Pillow restart or full reboot).
eureka is offline   Reply With Quote