public static long toMilliSeconds()

in common/src/main/java/org/mvndaemon/mvnd/common/TimeUtils.java [100:120]


    public static long toMilliSeconds(String source) throws IllegalArgumentException {
        Matcher matcher = DURATION_PATTERN.matcher(source);
        if (!matcher.matches()) {
            throw new IllegalArgumentException("Unable to parse duration: '" + source + "'");
        }
        String n = matcher.group("n");
        if (n != null) {
            return Long.parseLong(n);
        } else {
            String d = matcher.group("d");
            String h = matcher.group("h");
            String m = matcher.group("m");
            String s = matcher.group("s");
            String l = matcher.group("l");
            return (d != null ? TimeUnit.DAYS.toMillis(Long.parseLong(d)) : 0)
                    + (h != null ? TimeUnit.HOURS.toMillis(Long.parseLong(h)) : 0)
                    + (m != null ? TimeUnit.MINUTES.toMillis(Long.parseLong(m)) : 0)
                    + (s != null ? TimeUnit.SECONDS.toMillis(Long.parseLong(s)) : 0)
                    + (l != null ? TimeUnit.MILLISECONDS.toMillis(Long.parseLong(l)) : 0);
        }
    }