Module: OpenEHR::AssumedLibraryTypes::ISO8601TimeModule

Includes:
TimeDefinitions
Included in:
ISO8601DateTimeModule, ISO8601Time
Defined in:
lib/open_ehr/assumed_library_types.rb

Overview

end of ISO8601_DATE

Constant Summary

Constants included from TimeDefinitions

TimeDefinitions::DAYS_IN_LEAP_YEAR, TimeDefinitions::DAYS_IN_WEEK, TimeDefinitions::DAYS_IN_YEAR, TimeDefinitions::HOURS_IN_DAY, TimeDefinitions::MAX_DAYS_IN_MONTH, TimeDefinitions::MAX_DAYS_IN_YEAR, TimeDefinitions::MINUTES_IN_HOUR, TimeDefinitions::MONTH_IN_YEAR, TimeDefinitions::NOMINAL_DAYS_IN_MONTH, TimeDefinitions::NOMINAL_DAYS_IN_YEAR, TimeDefinitions::SECONDS_IN_MINUTE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TimeDefinitions

valid_day?, valid_hour?, valid_minute?, valid_month?, valid_second?, valid_year?

Instance Attribute Details

#fractional_secondObject

Returns the value of attribute fractional_second.



294
295
296
# File 'lib/open_ehr/assumed_library_types.rb', line 294

def fractional_second
  @fractional_second
end

#hourObject

Returns the value of attribute hour.



294
295
296
# File 'lib/open_ehr/assumed_library_types.rb', line 294

def hour
  @hour
end

#minuteObject

Returns the value of attribute minute.



294
295
296
# File 'lib/open_ehr/assumed_library_types.rb', line 294

def minute
  @minute
end

#secondObject

Returns the value of attribute second.



294
295
296
# File 'lib/open_ehr/assumed_library_types.rb', line 294

def second
  @second
end

Instance Method Details

#as_stringObject



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/open_ehr/assumed_library_types.rb', line 360

def as_string
  s = sprintf("%02d", @hour)
  if !@minute.nil?
    s += ":" + sprintf("%02d",@minute)
    if !@second.nil?
      s += ":" + sprintf("%02d", @second)
      if !@fractional_second.nil?
        s += "." + @fractional_second.to_s[2..-1]
        if !@timezone.nil?
          s += @timezone.to_s
        end
      end
    end
  end
  return s
end

#has_fractional_second?Boolean

Returns:

  • (Boolean)


332
333
334
# File 'lib/open_ehr/assumed_library_types.rb', line 332

def has_fractional_second?
  return !@fractional_second.nil?
end

#is_decimal_sign_comma?Boolean

Returns:

  • (Boolean)


348
349
350
# File 'lib/open_ehr/assumed_library_types.rb', line 348

def is_decimal_sign_comma?
  false
end

#is_extended?Boolean

Returns:

  • (Boolean)


352
353
354
# File 'lib/open_ehr/assumed_library_types.rb', line 352

def is_extended?
  true
end

#is_partial?Boolean

Returns:

  • (Boolean)


356
357
358
# File 'lib/open_ehr/assumed_library_types.rb', line 356

def is_partial?
  second_unknown? or minute_unknown?
end

#minute_unknown?Boolean

Returns:

  • (Boolean)


303
304
305
# File 'lib/open_ehr/assumed_library_types.rb', line 303

def minute_unknown?
  @minute.nil?
end

#second_unknown?Boolean

Returns:

  • (Boolean)


312
313
314
# File 'lib/open_ehr/assumed_library_types.rb', line 312

def second_unknown?
  @second.nil?
end

#timezoneObject



344
345
346
# File 'lib/open_ehr/assumed_library_types.rb', line 344

def timezone
  @timezone.to_s
end

#timezone=(timezone) ⇒ Object



336
337
338
339
340
341
342
# File 'lib/open_ehr/assumed_library_types.rb', line 336

def timezone=(timezone)
  unless timezone.nil? or timezone.empty?
    @timezone = Timezone.new(timezone)
  else
    @timezone = nil
  end
end

#to_secondObject



377
378
379
380
381
382
# File 'lib/open_ehr/assumed_library_types.rb', line 377

def to_second
  second = (nilthenzero(@hour)*60 + nilthenzero(@minute))*60 +
    nilthenzero(@second) +
    nilthenzero(@fractional_second)
  return second
end