public static function parseTime($timeSpan)
    {
        $times = array('s' => 1, 'm' => 60, 'h' => 3600, 'd' => 86400, 'w' => 604800);
        $matches = array();
        if (is_numeric($timeSpan)) {
            return $timeSpan;
        }
        if (preg_match('/^((\d+)?(\.\d+)?)('.implode('|', array_keys($times)).')$/',
                $timeSpan, $matches)) {
            return floatval($matches[1]) * $times[$matches[4]];
        }
        return null;
    }