timex_datalink_client 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/timex_datalink_client/helpers/four_byte_formatter.rb +29 -0
  3. data/lib/timex_datalink_client/protocol_4/alarm.rb +59 -0
  4. data/lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb +44 -0
  5. data/lib/timex_datalink_client/protocol_4/eeprom/appointment.rb +49 -0
  6. data/lib/timex_datalink_client/protocol_4/eeprom/list.rb +43 -0
  7. data/lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb +56 -0
  8. data/lib/timex_datalink_client/protocol_4/eeprom.rb +95 -0
  9. data/lib/timex_datalink_client/protocol_4/end.rb +20 -0
  10. data/lib/timex_datalink_client/protocol_4/sound_options.rb +42 -0
  11. data/lib/timex_datalink_client/protocol_4/sound_theme.rb +65 -0
  12. data/lib/timex_datalink_client/protocol_4/start.rb +20 -0
  13. data/lib/timex_datalink_client/protocol_4/sync.rb +40 -0
  14. data/lib/timex_datalink_client/protocol_4/time.rb +77 -0
  15. data/lib/timex_datalink_client/protocol_4/wrist_app.rb +67 -0
  16. data/lib/timex_datalink_client/protocol_7/eeprom/activity.rb +94 -0
  17. data/lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb +33 -0
  18. data/lib/timex_datalink_client/protocol_7/eeprom/calendar.rb +91 -0
  19. data/lib/timex_datalink_client/protocol_7/eeprom/games.rb +124 -0
  20. data/lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb +79 -0
  21. data/lib/timex_datalink_client/protocol_7/eeprom/speech.rb +228 -0
  22. data/lib/timex_datalink_client/protocol_7/eeprom.rb +76 -0
  23. data/lib/timex_datalink_client/protocol_7/end.rb +20 -0
  24. data/lib/timex_datalink_client/protocol_7/phrase_builder.rb +70 -0
  25. data/lib/timex_datalink_client/protocol_7/start.rb +20 -0
  26. data/lib/timex_datalink_client/protocol_7/sync.rb +40 -0
  27. data/lib/timex_datalink_client/version.rb +1 -1
  28. data/lib/timex_datalink_client.rb +34 -5
  29. metadata +42 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1e1ba04b363121e40f0dd55b6ec5b6b97abed22e912f2b5155f11a0bef098c7
4
- data.tar.gz: fbfaed8471f55ab6d5ebfa515f62f1d396239e4b9c043a3aad2f783be3007219
3
+ metadata.gz: 93fe636dc699046ea5c14683b355f8c65bb162fb18ee91b3ffe27f4a72633808
4
+ data.tar.gz: d9476317e2cce78a77247c277e77208969f6e8fa13059a2e0f7452f502f9b112
5
5
  SHA512:
6
- metadata.gz: fca16b6fdacba5294c6eb4b5645f5e2a8b54f3f38b1477771d84357e6365bb7e39e0821d9827e912d35f0f0dd2a58a081f422f650f604fb28770e55093895e41
7
- data.tar.gz: fa6e1bc0cb2f273e729510cb6eabc4399c90c034ae3b7888fde84160aaff0a57b4867ba661929a437558613401435aa62e1ab71790494d764536cff6949b41a1
6
+ metadata.gz: 313b6bc8ea78a28ee55534ff28648a6544a8aa7dcf1abd731461fc7b9c21ba3711d441de603d7f538666541d5fce4ca0d6206449a2b8cee6cf5d56a263f8691a
7
+ data.tar.gz: df31c376348f69fd05ba4c0de720e443074f68d63788601610021e0328598af3cfa8a3f85789336d20e80aac90be5ac32526bc6872d208afdd2c6965582f1617
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TimexDatalinkClient
4
+ class Helpers
5
+ module FourByteFormatter
6
+ BYTE_NULL = 0x000
7
+ BYTE_TERMINATOR_ENDF = 0x3fe
8
+ BYTE_TERMINATOR_ENDR = 0x3ff
9
+
10
+ def four_byte_format_for(byte_arrays)
11
+ byte_arrays.each_with_index.flat_map do |bytes, bytes_index|
12
+ last_index = bytes_index == byte_arrays.count - 1
13
+ terminator = last_index ? BYTE_TERMINATOR_ENDR : BYTE_TERMINATOR_ENDF
14
+
15
+ bytes_with_terminator = bytes + [terminator]
16
+
17
+ bytes_with_terminator.each_slice(4).flat_map do |bytes_slice|
18
+ bytes_slice.fill(BYTE_NULL, bytes_slice.count, 4 - bytes_slice.count)
19
+
20
+ packet_lsbs_sum = bytes_slice.each_with_index.sum { |byte, index| byte / 256 << 6 - index * 2 }
21
+ packet_msbs = bytes_slice.map { |byte| byte % 256 }
22
+
23
+ [packet_lsbs_sum] + packet_msbs
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Alarm
9
+ include Helpers::CharEncoders
10
+ prepend Helpers::CrcPacketsWrapper
11
+
12
+ CPACKET_ALARM = [0x50]
13
+
14
+ attr_accessor :number, :audible, :time, :message
15
+
16
+ # Create an Alarm instance.
17
+ #
18
+ # @param number [Integer] Alarm number (from 1 to 5).
19
+ # @param audible [Boolean] Toggle alarm sounds.
20
+ # @param time [::Time] Time of alarm.
21
+ # @param message [String] Alarm message text.
22
+ # @return [Alarm] Alarm instance.
23
+ def initialize(number:, audible:, time:, message:)
24
+ @number = number
25
+ @audible = audible
26
+ @time = time
27
+ @message = message
28
+ end
29
+
30
+ # Compile packets for an alarm.
31
+ #
32
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
33
+ def packets
34
+ [
35
+ [
36
+ CPACKET_ALARM,
37
+ number,
38
+ time.hour,
39
+ time.min,
40
+ 0,
41
+ 0,
42
+ message_characters,
43
+ audible_integer
44
+ ].flatten
45
+ ]
46
+ end
47
+
48
+ private
49
+
50
+ def message_characters
51
+ chars_for(message, length: 8, pad: true)
52
+ end
53
+
54
+ def audible_integer
55
+ audible ? 1 : 0
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/length_packet_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Eeprom
9
+ class Anniversary
10
+ include Helpers::CharEncoders
11
+ prepend Helpers::LengthPacketWrapper
12
+
13
+ attr_accessor :time, :anniversary
14
+
15
+ # Create an Anniversary instance.
16
+ #
17
+ # @param time [::Time] Time of anniversary.
18
+ # @param anniversary [String] Anniversary text.
19
+ # @return [Anniversary] Anniversary instance.
20
+ def initialize(time:, anniversary:)
21
+ @time = time
22
+ @anniversary = anniversary
23
+ end
24
+
25
+ # Compile a packet for an anniversary.
26
+ #
27
+ # @return [Array<Integer>] Array of integers that represent bytes.
28
+ def packet
29
+ [
30
+ time.month,
31
+ time.day,
32
+ anniversary_characters
33
+ ].flatten
34
+ end
35
+
36
+ private
37
+
38
+ def anniversary_characters
39
+ eeprom_chars_for(anniversary)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/length_packet_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Eeprom
9
+ class Appointment
10
+ include Helpers::CharEncoders
11
+ prepend Helpers::LengthPacketWrapper
12
+
13
+ attr_accessor :time, :message
14
+
15
+ # Create an Appointment instance.
16
+ #
17
+ # @param time [::Time] Time of appointment.
18
+ # @param message [String] Appointment text.
19
+ # @return [Appointment] Appointment instance.
20
+ def initialize(time:, message:)
21
+ @time = time
22
+ @message = message
23
+ end
24
+
25
+ # Compile a packet for an appointment.
26
+ #
27
+ # @return [Array<Integer>] Array of integers that represent bytes.
28
+ def packet
29
+ [
30
+ time.month,
31
+ time.day,
32
+ time_15m,
33
+ message_characters
34
+ ].flatten
35
+ end
36
+
37
+ private
38
+
39
+ def time_15m
40
+ time.hour * 4 + time.min / 15
41
+ end
42
+
43
+ def message_characters
44
+ eeprom_chars_for(message)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/length_packet_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Eeprom
9
+ class List
10
+ include Helpers::CharEncoders
11
+ prepend Helpers::LengthPacketWrapper
12
+
13
+ attr_accessor :list_entry, :priority
14
+
15
+ # Create a List instance.
16
+ #
17
+ # @param list_entry [String] List entry text.
18
+ # @param priority [Integer] List priority.
19
+ # @return [List] List instance.
20
+ def initialize(list_entry:, priority:)
21
+ @list_entry = list_entry
22
+ @priority = priority
23
+ end
24
+
25
+ # Compile a packet for a list.
26
+ #
27
+ # @return [Array<Integer>] Array of integers that represent bytes.
28
+ def packet
29
+ [
30
+ priority,
31
+ list_entry_characters
32
+ ].flatten
33
+ end
34
+
35
+ private
36
+
37
+ def list_entry_characters
38
+ eeprom_chars_for(list_entry)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/length_packet_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Eeprom
9
+ class PhoneNumber
10
+ include Helpers::CharEncoders
11
+ prepend Helpers::LengthPacketWrapper
12
+
13
+ PHONE_DIGITS = 12
14
+
15
+ attr_accessor :name, :number, :type
16
+
17
+ # Create a PhoneNumber instance.
18
+ #
19
+ # @param name [String] Name associated to phone number.
20
+ # @param number [String] Phone number text.
21
+ # @param type [String] Phone number type.
22
+ # @return [PhoneNumber] PhoneNumber instance.
23
+ def initialize(name:, number:, type: " ")
24
+ @name = name
25
+ @number = number
26
+ @type = type
27
+ end
28
+
29
+ # Compile a packet for a phone number.
30
+ #
31
+ # @return [Array<Integer>] Array of integers that represent bytes.
32
+ def packet
33
+ [
34
+ number_with_type_characters,
35
+ name_characters
36
+ ].flatten
37
+ end
38
+
39
+ private
40
+
41
+ def number_with_type_padded
42
+ number_with_type = "#{number} #{type}"
43
+ number_with_type.rjust(PHONE_DIGITS)
44
+ end
45
+
46
+ def number_with_type_characters
47
+ phone_chars_for(number_with_type_padded)
48
+ end
49
+
50
+ def name_characters
51
+ eeprom_chars_for(name)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/cpacket_paginator"
4
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Eeprom
9
+ include Helpers::CpacketPaginator
10
+ prepend Helpers::CrcPacketsWrapper
11
+
12
+ CPACKET_CLEAR = [0x93, 0x01]
13
+ CPACKET_SECT = [0x90, 0x01]
14
+ CPACKET_DATA = [0x91, 0x01]
15
+ CPACKET_END = [0x92, 0x01]
16
+
17
+ CPACKET_DATA_LENGTH = 32
18
+ START_ADDRESS = 0x0236
19
+ APPOINTMENT_NO_NOTIFICATION = 0xff
20
+
21
+ attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification
22
+
23
+ # Create an Eeprom instance.
24
+ #
25
+ # @param appointments [Array<Appointment>] Appointments to be added to EEPROM data.
26
+ # @param anniversaries [Array<Anniversary>] Anniversaries to be added to EEPROM data.
27
+ # @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
28
+ # @param lists [Array<List>] Lists to be added to EEPROM data.
29
+ # @param appointment_notification [Integer] Appointment notification (intervals of 15 minutes, 255 for no
30
+ # notification)
31
+ # @return [Eeprom] Eeprom instance.
32
+ def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
33
+ @appointments = appointments
34
+ @anniversaries = anniversaries
35
+ @phone_numbers = phone_numbers
36
+ @lists = lists
37
+ @appointment_notification = appointment_notification
38
+ end
39
+
40
+ # Compile packets for EEPROM data.
41
+ #
42
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
43
+ def packets
44
+ [CPACKET_CLEAR, header] + payloads + [CPACKET_END]
45
+ end
46
+
47
+ private
48
+
49
+ def header
50
+ [
51
+ CPACKET_SECT,
52
+ payloads.length,
53
+ items_addresses,
54
+ items_lengths,
55
+ earliest_appointment_year,
56
+ appointment_notification
57
+ ].flatten
58
+ end
59
+
60
+ def payloads
61
+ paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: all_packets)
62
+ end
63
+
64
+ def all_items
65
+ [appointments, lists, phone_numbers, anniversaries]
66
+ end
67
+
68
+ def all_packets
69
+ all_items.flatten.map(&:packet).flatten
70
+ end
71
+
72
+ def items_addresses
73
+ address = START_ADDRESS
74
+
75
+ all_items.each_with_object([]) do |items, addresses|
76
+ addresses.concat(address.divmod(256))
77
+
78
+ address += items.sum { |item| item.packet.length }
79
+ end
80
+ end
81
+
82
+ def items_lengths
83
+ all_items.map(&:length)
84
+ end
85
+
86
+ def earliest_appointment_year
87
+ earliest_appointment = appointments.min_by(&:time)
88
+
89
+ return 0 unless earliest_appointment
90
+
91
+ earliest_appointment.time.year % 100
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
4
+
5
+ class TimexDatalinkClient
6
+ class Protocol4
7
+ class End
8
+ prepend Helpers::CrcPacketsWrapper
9
+
10
+ CPACKET_SKIP = [0x21]
11
+
12
+ # Compile packets for data end command.
13
+ #
14
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
15
+ def packets
16
+ [CPACKET_SKIP]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
4
+
5
+ class TimexDatalinkClient
6
+ class Protocol4
7
+ class SoundOptions
8
+ prepend Helpers::CrcPacketsWrapper
9
+
10
+ CPACKET_BEEPS = [0x71]
11
+
12
+ attr_accessor :hourly_chime, :button_beep
13
+
14
+ # Create a SoundOptions instance.
15
+ #
16
+ # @param hourly_chime [Boolean] Toggle hourly chime sounds.
17
+ # @param button_beep [Boolean] Toggle button beep sounds.
18
+ # @return [SoundOptions] SoundOptions instance.
19
+ def initialize(hourly_chime:, button_beep:)
20
+ @hourly_chime = hourly_chime
21
+ @button_beep = button_beep
22
+ end
23
+
24
+ # Compile packets for sound options.
25
+ #
26
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
27
+ def packets
28
+ [
29
+ CPACKET_BEEPS + [hourly_chime_integer, button_beep_integer]
30
+ ]
31
+ end
32
+
33
+ def hourly_chime_integer
34
+ hourly_chime ? 1 : 0
35
+ end
36
+
37
+ def button_beep_integer
38
+ button_beep ? 1 : 0
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/cpacket_paginator"
4
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class SoundTheme
9
+ include Helpers::CpacketPaginator
10
+ prepend Helpers::CrcPacketsWrapper
11
+
12
+ CPACKET_SECT = [0x90, 0x03]
13
+ CPACKET_DATA = [0x91, 0x03]
14
+ CPACKET_END = [0x92, 0x03]
15
+
16
+ CPACKET_DATA_LENGTH = 32
17
+ SOUND_DATA_HEADER = "\x25\x04\x19\x69"
18
+
19
+ attr_accessor :spc_file
20
+
21
+ # Create a SoundTheme instance.
22
+ #
23
+ # @param sound_theme_data [String, nil] Sound theme data.
24
+ # @param spc_file [String, nil] Path to SPC file.
25
+ # @return [SoundTheme] SoundTheme instance.
26
+ def initialize(sound_theme_data: nil, spc_file: nil)
27
+ @sound_theme_data = sound_theme_data
28
+ @spc_file = spc_file
29
+ end
30
+
31
+ # Compile packets for a sound theme.
32
+ #
33
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
34
+ def packets
35
+ [load_sect] + payloads + [CPACKET_END]
36
+ end
37
+
38
+ private
39
+
40
+ def load_sect
41
+ CPACKET_SECT + [payloads.length, offset]
42
+ end
43
+
44
+ def payloads
45
+ paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: sound_theme_data.bytes)
46
+ end
47
+
48
+ def sound_theme_data
49
+ @sound_theme_data || spc_file_data_without_header
50
+ end
51
+
52
+ def spc_file_data
53
+ File.open(spc_file, "rb").read
54
+ end
55
+
56
+ def spc_file_data_without_header
57
+ spc_file_data.delete_prefix(SOUND_DATA_HEADER)
58
+ end
59
+
60
+ def offset
61
+ 0x100 - sound_theme_data.bytesize
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
4
+
5
+ class TimexDatalinkClient
6
+ class Protocol4
7
+ class Start
8
+ prepend Helpers::CrcPacketsWrapper
9
+
10
+ CPACKET_START = [0x20, 0x00, 0x00, 0x04]
11
+
12
+ # Compile packets for data start command.
13
+ #
14
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
15
+ def packets
16
+ [CPACKET_START]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TimexDatalinkClient
4
+ class Protocol4
5
+ class Sync
6
+ PING_BYTE = [0x78]
7
+ SYNC_1_BYTE = [0x55]
8
+ SYNC_2_BYTE = [0xaa]
9
+
10
+ SYNC_2_LENGTH = 40
11
+
12
+ attr_accessor :length
13
+
14
+ # Create a Sync instance.
15
+ #
16
+ # @param length [Integer] Number of 0x55 sync bytes to use.
17
+ # @return [Sync] Sync instance.
18
+ def initialize(length: 300)
19
+ @length = length
20
+ end
21
+
22
+ # Compile packets for syncronization data.
23
+ #
24
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
25
+ def packets
26
+ [PING_BYTE + render_sync_1 + render_sync_2]
27
+ end
28
+
29
+ private
30
+
31
+ def render_sync_1
32
+ SYNC_1_BYTE * length
33
+ end
34
+
35
+ def render_sync_2
36
+ SYNC_2_BYTE * SYNC_2_LENGTH
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "timex_datalink_client/helpers/char_encoders"
4
+ require "timex_datalink_client/helpers/crc_packets_wrapper"
5
+
6
+ class TimexDatalinkClient
7
+ class Protocol4
8
+ class Time
9
+ include Helpers::CharEncoders
10
+ prepend Helpers::CrcPacketsWrapper
11
+
12
+ CPACKET_TIME = [0x32]
13
+
14
+ attr_accessor :zone, :is_24h, :date_format, :time
15
+
16
+ # Create a Time instance.
17
+ #
18
+ # @param zone [Integer] Time zone number (1 or 2).
19
+ # @param is_24h [Boolean] Toggle 24 hour time.
20
+ # @param date_format [Integer] Date format.
21
+ # @param time [::Time] Time to set (including time zone).
22
+ # @param name [String, nil] Name of time zone (defaults to zone from time; 3 chars max)
23
+ # @return [Time] Time instance.
24
+ def initialize(zone:, is_24h:, date_format:, time:, name: nil)
25
+ @zone = zone
26
+ @is_24h = is_24h
27
+ @date_format = date_format
28
+ @time = time
29
+ @name = name
30
+ end
31
+
32
+ # Compile packets for a time.
33
+ #
34
+ # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
35
+ def packets
36
+ [
37
+ [
38
+ CPACKET_TIME,
39
+ zone,
40
+ time.sec,
41
+ time.hour,
42
+ time.min,
43
+ time.month,
44
+ time.day,
45
+ year_mod_1900,
46
+ name_characters,
47
+ wday_from_monday,
48
+ is_24h_value,
49
+ date_format
50
+ ].flatten
51
+ ]
52
+ end
53
+
54
+ private
55
+
56
+ def name
57
+ @name || time.zone.downcase
58
+ end
59
+
60
+ def name_characters
61
+ chars_for(name, length: 3, pad: true)
62
+ end
63
+
64
+ def year_mod_1900
65
+ time.year % 100
66
+ end
67
+
68
+ def wday_from_monday
69
+ (time.wday + 6) % 7
70
+ end
71
+
72
+ def is_24h_value
73
+ is_24h ? 2 : 1
74
+ end
75
+ end
76
+ end
77
+ end