def get_hwclock_seconds(utc=True):
 cmd = '/sbin/hwclock --debug'
 if utc:
  cmd += ' --utc'
 hwclock_output = utils.system_output(cmd, ignore_status=True)
 match = re.search('= ([0-9]+) seconds since .+ (-?[0-9.]+) seconds$', hwclock_output, re.DOTALL)
 if match:
  seconds = (int(match.group(1)) + float(match.group(2)))
  logging.debug(('hwclock seconds = %f' % seconds))
  return seconds
 raise ValueError(('Unable to read the hardware clock -- ' + hwclock_output))

def get_hwclock_seconds ( utc = True ) : cmd = '/sbin/hwclock --debug' if utc : cmd += ' --utc' hwclock_output = utils . system_output ( cmd , ignore_status = True ) match = re . search ( '= ([0-9]+) seconds since .+ (-?[0-9.]+) seconds$' , hwclock_output , re . DOTALL ) if match : seconds = ( int ( match . group ( 1 ) ) + float ( match . group ( 2 ) ) ) logging . debug ( ( 'hwclock seconds = %f' % seconds ) ) return seconds raise ValueError ( ( 'Unable to read the hardware clock -- ' + hwclock_output ) )
return the hardware clock in seconds as a floating point value .