Description:
[web] more use of utc time
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@248 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r120:a805b8fa46cc - - 1 file changed: 2 inserted, 2 deleted
@@ -18,67 +18,67 | |||
|
18 | 18 | menu_items << "<br/>" |
|
19 | 19 | end |
|
20 | 20 | |
|
21 | 21 | # main page |
|
22 | 22 | append_to menu_items, '[Main]', 'main', 'list' |
|
23 | 23 | append_to menu_items, '[Messages]', 'messages', 'list' |
|
24 | 24 | append_to menu_items, '[Tasks]', 'tasks', 'list' |
|
25 | 25 | append_to menu_items, '[Submissions]', 'main', 'submission' |
|
26 | 26 | append_to menu_items, '[Test]', 'test', 'index' |
|
27 | 27 | append_to menu_items, '[Help]', 'main', 'help' |
|
28 | 28 | #append_to menu_items, '[Settings]', 'users', 'index' |
|
29 | 29 | append_to menu_items, '[Log out]', 'main', 'login' |
|
30 | 30 | |
|
31 | 31 | menu_items |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | def append_to(option,label, controller, action) |
|
35 | 35 | option << ' ' if option!='' |
|
36 | 36 | option << link_to_unless_current(label, |
|
37 | 37 | :controller => controller, |
|
38 | 38 | :action => action) |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | def format_short_time(time) |
|
42 | - now = Time.now | |
|
42 | + now = Time.now.gmtime | |
|
43 | 43 | st = '' |
|
44 | 44 | if (time.yday != now.yday) or |
|
45 | 45 | (time.year != now.year) |
|
46 | 46 | st = time.strftime("%x ") |
|
47 | 47 | end |
|
48 | 48 | st + time.strftime("%X") |
|
49 | 49 | end |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | def user_title_bar(user) |
|
53 | 53 | if user.site!=nil and user.site.finished? |
|
54 | 54 | contest_over_string = <<CONTEST_OVER |
|
55 | 55 | <tr><td colspan="2" align="center"> |
|
56 | 56 | <span class="contest-over-msg">THE CONTEST IS OVER</span> |
|
57 | 57 | </td></tr> |
|
58 | 58 | CONTEST_OVER |
|
59 | 59 | end |
|
60 | 60 | <<TITLEBAR |
|
61 | 61 | <div class="title"> |
|
62 | 62 | <table> |
|
63 | 63 | #{contest_over_string} |
|
64 | 64 | <tr> |
|
65 | 65 | <td class="left-col"> |
|
66 | 66 | #{user.full_name}<br/> |
|
67 | - Current time is #{format_short_time(Time.new)}<br/> | |
|
67 | + Current time is #{format_short_time(Time.new.gmtime)} UTC<br/> | |
|
68 | 68 | </td> |
|
69 | 69 | <td class="right-col">APIO'08</td> |
|
70 | 70 | </tr> |
|
71 | 71 | </table> |
|
72 | 72 | </div> |
|
73 | 73 | TITLEBAR |
|
74 | 74 | end |
|
75 | 75 | |
|
76 | 76 | def read_textfile(fname,max_size=2048) |
|
77 | 77 | begin |
|
78 | 78 | File.open(fname).read(max_size) |
|
79 | 79 | rescue |
|
80 | 80 | nil |
|
81 | 81 | end |
|
82 | 82 | end |
|
83 | 83 | |
|
84 | 84 | end |
You need to be logged in to leave comments.
Login now