001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.anarres.qemu.exec;
006
007import java.util.List;
008import javax.annotation.Nonnull;
009
010/**
011 *
012 * @author shevek
013 */
014public class QEmuRtcOption extends AbstractQEmuOption {
015
016    // [base=utc|localtime|date][,clock=host|vm][,driftfix=none|slew]
017    public static enum Base {
018
019        utc, localtime
020    }
021
022    public static enum Clock {
023
024        host, vm
025    }
026
027    public static enum Driftfix {
028
029        none, slew
030    }
031    private Base base;
032    private Clock clock;
033    private Driftfix driftfix;
034
035    @Nonnull
036    public QEmuRtcOption withBase(Base base) {
037        this.base = base;
038        return this;
039    }
040
041    @Nonnull
042    public QEmuRtcOption withClock(Clock clock) {
043        this.clock = clock;
044        return this;
045    }
046
047    @Nonnull
048    public QEmuRtcOption withDriftfix(Driftfix driftfix) {
049        this.driftfix = driftfix;
050        return this;
051    }
052
053    @Override
054    public void appendTo(List<? super String> line) {
055        StringBuilder buf = new StringBuilder();
056        appendTo(buf, "base", base);
057        appendTo(buf, "clock", clock);
058        appendTo(buf, "driftfix", driftfix);
059        add(line, "-rtc", buf.toString());
060    }
061}