def InitializeLinuxNowFunction(plat):
  """Sets a monotonic clock for linux platforms.

    Args:
      plat: Platform that is being run on.
  """
  global _CLOCK  # pylint: disable=global-statement
  global _NOW_FUNCTION  # pylint: disable=global-statement
  _CLOCK = _LINUX_CLOCK
  clock_monotonic = GetClockGetTimeClockNumber(plat)
  try:
    # Attempt to find clock_gettime in the C library.
    clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),
                                use_errno=True).clock_gettime
  except AttributeError:
    # If not able to find int in the C library, look in rt library.
    clock_gettime = ctypes.CDLL(ctypes.util.find_library('rt'),
                                use_errno=True).clock_gettime

  class Timespec(ctypes.Structure):
    """Time specification, as described in clock_gettime(3)."""
    _fields_ = (('tv_sec', ctypes.c_long),
                ('tv_nsec', ctypes.c_long))

  def LinuxNowFunctionImpl():
    ts = Timespec()
    if clock_gettime(clock_monotonic, ctypes.pointer(ts)):
      errno = ctypes.get_errno()
      raise OSError(errno, os.strerror(errno))
    return ts.tv_sec + ts.tv_nsec / 1.0e9

  _NOW_FUNCTION = LinuxNowFunctionImpl