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:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r120:a805b8fa46cc - - 1 file changed: 2 inserted, 2 deleted

@@ -30,50 +30,50
30
30
31 menu_items
31 menu_items
32 end
32 end
33
33
34 def append_to(option,label, controller, action)
34 def append_to(option,label, controller, action)
35 option << ' ' if option!=''
35 option << ' ' if option!=''
36 option << link_to_unless_current(label,
36 option << link_to_unless_current(label,
37 :controller => controller,
37 :controller => controller,
38 :action => action)
38 :action => action)
39 end
39 end
40
40
41 def format_short_time(time)
41 def format_short_time(time)
42 - now = Time.now
42 + now = Time.now.gmtime
43 st = ''
43 st = ''
44 if (time.yday != now.yday) or
44 if (time.yday != now.yday) or
45 (time.year != now.year)
45 (time.year != now.year)
46 st = time.strftime("%x ")
46 st = time.strftime("%x ")
47 end
47 end
48 st + time.strftime("%X")
48 st + time.strftime("%X")
49 end
49 end
50
50
51
51
52 def user_title_bar(user)
52 def user_title_bar(user)
53 if user.site!=nil and user.site.finished?
53 if user.site!=nil and user.site.finished?
54 contest_over_string = <<CONTEST_OVER
54 contest_over_string = <<CONTEST_OVER
55 <tr><td colspan="2" align="center">
55 <tr><td colspan="2" align="center">
56 <span class="contest-over-msg">THE CONTEST IS OVER</span>
56 <span class="contest-over-msg">THE CONTEST IS OVER</span>
57 </td></tr>
57 </td></tr>
58 CONTEST_OVER
58 CONTEST_OVER
59 end
59 end
60 <<TITLEBAR
60 <<TITLEBAR
61 <div class="title">
61 <div class="title">
62 <table>
62 <table>
63 #{contest_over_string}
63 #{contest_over_string}
64 <tr>
64 <tr>
65 <td class="left-col">
65 <td class="left-col">
66 #{user.full_name}<br/>
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 </td>
68 </td>
69 <td class="right-col">APIO'08</td>
69 <td class="right-col">APIO'08</td>
70 </tr>
70 </tr>
71 </table>
71 </table>
72 </div>
72 </div>
73 TITLEBAR
73 TITLEBAR
74 end
74 end
75
75
76 def read_textfile(fname,max_size=2048)
76 def read_textfile(fname,max_size=2048)
77 begin
77 begin
78 File.open(fname).read(max_size)
78 File.open(fname).read(max_size)
79 rescue
79 rescue
You need to be logged in to leave comments. Login now