Normalize timestamp printing.

Add new function formatTime() for formatting timestamps.
Add dropdown menu to Timestamp component.
Use formatTime() or m(Timestamp, ...) for timestamps in panels.

Change-Id: Ic17d242a32be25f97bfb0094e4374827ce5a3676
diff --git a/ui/src/frontend/thread_state_tab.ts b/ui/src/frontend/thread_state_tab.ts
index 3547939..b30b540 100644
--- a/ui/src/frontend/thread_state_tab.ts
+++ b/ui/src/frontend/thread_state_tab.ts
@@ -19,7 +19,7 @@
 import {Anchor} from './anchor';
 import {BottomTab, bottomTabRegistry, NewBottomTabArgs} from './bottom_tab';
 import {globals} from './globals';
-import {SchedSqlId, ThreadStateSqlId} from './sql_types';
+import {asTPTimestamp, SchedSqlId, ThreadStateSqlId} from './sql_types';
 import {
   getProcessName,
   getThreadName,
@@ -30,6 +30,7 @@
 import {GridLayout} from './widgets/grid_layout';
 import {Section} from './widgets/section';
 import {SqlRef} from './widgets/sql_ref';
+import {Timestamp} from './widgets/timestamp';
 import {Tree, TreeNode} from './widgets/tree';
 
 interface ThreadStateTabConfig {
@@ -95,7 +96,7 @@
         Tree,
         m(TreeNode, {
           left: 'Start time',
-          right: tpTimeToCode(state.ts - globals.state.traceTime.start),
+          right: m(Timestamp, {ts: asTPTimestamp(state.ts)}),
         }),
         m(TreeNode, {
           left: 'Duration',