Puppet function for converting units of time




5,914 latest version

4.6 quality score

Version information

  • 0.1.0 (latest)
released Oct 6th 2016
This version is compatible with:
  • RedHat, Ubuntu, Debian, Fedora, CentOS

Start using this module


deanwilson/time_units — version 0.1.0 Oct 6th 2016


A small Puppet function to convert from one unit of time to another.

Build Status Puppet Forge

In a large Puppet code base you'll eventually end up with a scattering of time based 'magic numbers such as cache expiry numbers, zone file ttls and recurring job schedules. You'll typically find these dealt with in one of a few ways. The easiest is to ignore it and leave a hopefully guessable literal value (such as 3600). The other often taken is the dreaded heavily linked comments that start off as 86400 # seconds in a day and over time becomes 3600 # seconds in a day.

This module is a proof of concept that uses a puppet function to make these kind of calls more explicit while keeping larger magic numbers from the code base.


A basic conversion is called like this:

time_units(15, 'minutes', 'seconds') # returns 900

You can also make calls using a slightly 'prettier' 4 argument version

time_units(2, 'hours', 'in', 'minutes') # returns 120


You can install this module from PuppetForge:

puppet module install deanwilson-time_units


Apache 2.0 - Dean Wilson