Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This class calculates the current year given an origin day
- # supplied by a clock chip.
- #
- # Author:: Armando Fox
- # Copyright:: Copyright(C) 2011 by Armando Fox
- # License:: Distributed under the BSD License
- #
- class DateCalculator
- #
- # Create a new DateCalculator initialized to the origin year
- # * +origin_year+ - days will be calculated from Jan. 1 of this year
- #
- def initialize(origin_year)
- @origin_year = origin_year
- end
- #
- # Returns current year, given days since origin year
- # * +days_since_origin+ - number of days elapsed since Jan. 1 of origin year
- #
- def current_year_from_days(days_since_origin)
- return @origin_year
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement