equal
deleted
inserted
replaced
1 -*- mode: outline; coding: utf-8; -*- |
|
2 |
|
3 * System timer and system time. |
|
4 |
|
5 ** Windows. |
|
6 |
|
7 Windows assume that system timer display locale time. |
|
8 |
|
9 ** Debian. |
|
10 |
|
11 UTC=no - system timer display locale time, UTC=yes - UTC time. |
|
12 |
|
13 $ cat /etc/default/rcS |
|
14 UTC=no |
|
15 or |
|
16 UTC=yes |
|
17 |
|
18 If system dual boot with Windows you must set UTC=no. |
|
19 |
|
20 * Getting current date/time. |
|
21 |
|
22 $ date +"%Y-%m-%d %H:%M:%S" |
|
23 |
|
24 * Setting current date/time. |
|
25 |
|
26 $ sudo date --set="2009-02-22 12:12:00" +"%Y-%m-%d %H:%M:%S" |
|
27 |
|
28 Or set utc time: |
|
29 |
|
30 $ sudo date --utc --set="2009-02-22 12:12:00" +"%Y-%m-%d %H:%M:%S" |
|
31 |
|
32 May be prefer use ntpdate(8) command. |
|
33 |
|
34 * Get timezone. |
|
35 |
|
36 System wide configuration: |
|
37 |
|
38 $ cat /etc/timezone |
|
39 |
|
40 * Get list of supported timezone. |
|
41 |
|
42 $ tzselect |
|
43 |
|
44 * Set timezone. |
|
45 |
|
46 $ sudo tzconfig |
|
47 ... |
|
48 |
|
49 Or using tzselect: |
|
50 |
|
51 $ sudo tzselect |
|
52 ... |
|
53 |
|
54 ** Debian Lenny. |
|
55 |
|
56 $ sudo dpkg-reconfigure tzdata |
|
57 |
|
58 * About timestamp. |
|
59 |
|
60 http://en.wikipedia.org/wiki/Timestamp |
|
61 http://en.wikipedia.org/wiki/Unix_time |
|
62 http://en.wikipedia.org/wiki/Leap_second |
|
63 |
|
64 ** Get timestamp. |
|
65 |
|
66 Current timestamp: |
|
67 |
|
68 $ date +%s |
|
69 |
|
70 Timestamp for specific date/time: |
|
71 |
|
72 $ date -d '2010-12-11' +%s |
|
73 $ date -d '2010-12-11 23:59:59' +%s |
|
74 |
|
75 ** Convert unix timestamp to date. |
|
76 |
|
77 $ date -d '1970-01-01 + 1234567890 seconds' |
|
78 |
|