Skip to content

Commit fb47138

Browse files
committed
moar notage in examples.rb
1 parent f477975 commit fb47138

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@
33

44
=begin
55
6+
Tickle creates standard Ruby Time objects.
7+
68
Time is ignored if there's also a date, unless the date is 'tomorrow'(?)
79
810
Tickle creates times in the servers local time zone.
911
To go from server time to user's local time...
1012
user_time = server_time + (user_time_offset - server_time_offset)
1113
eg (5:00PM Central) = (6:00PM Eastern + (-6 - -5))
1214
15+
Tickle makes 'May 30th' at 0:00, but 'June 18, 2011' and 'Christmas' at 12:00.
1316
=end
1417

1518

1619
server_offset = Time.now.utc_offset / 60 / 60
1720

18-
['May 30th at midnight', '6:30 PM',
21+
['May 30th', '6:30 PM',
1922
'tomorrow at 6:00', 'June 18, 2011', 'Christmas'].each {|s|
2023
time = Tickle.parse(s)[:next]
24+
if s == 'Christmas'
25+
time -= 12 * 60 * 60
26+
end
2127
print s, " --> server date: ", time
2228
puts
23-
print s, " --> utc date: ", time.utc
24-
puts
25-
}
29+
}

0 commit comments

Comments
 (0)