Repository: microsoft/gctoolkit
File: parser/src/main/java/com/microsoft/gctoolkit/parser/GCLogParser.java (Java)

Code before:

import com.microsoft.gctoolkit.event.CPUSummary;
import com.microsoft.gctoolkit.event.MemoryPoolSummary;
import com.microsoft.gctoolkit.event.ReferenceGCSummary;
import com.microsoft.gctoolkit.event.jvm.JVMEvent;
import com.microsoft.gctoolkit.event.jvm.MetaspaceRecord;
import com.microsoft.gctoolkit.event.jvm.PermGenSummary;
import com.microsoft.gctoolkit.io.GCLogFile;
import com.microsoft.gctoolkit.jvm.Diary;
import com.microsoft.gctoolkit.message.ChannelName;
import com.microsoft.gctoolkit.message.DataSourceParser;
import com.microsoft.gctoolkit.message.JVMEventChannel;
import com.microsoft.gctoolkit.time.DateTimeStamp;

import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class GCLogParser implements DataSourceParser, SharedPatterns {

    private static final Logger LOGGER = Logger.getLogger(GCLogParser.class.getName());
    public static final String END_OF_DATA_SENTINEL = GCLogFile.END_OF_DATA_SENTINEL;

    public static final GCParseRule GCID_COUNTER = new GCParseRule("GCID_COUNTER", " GC\\((\\d+)\\) ");
    private JVMEventChannel consumer;
    protected Diary diary;
    private DateTimeStamp clock = new DateTimeStamp(DateTimeStamp.EPOC,0.0d);
    private double lastDuration = 0.0d;


    public GCLogParser() {}

    /**
     * Setting the diary will set the current clock time to the time of the first event
     * in the GC log. This is a better choice than EPOC though EPOC is better than null.
     * @param diary summary the GC log.
     */
    @Override
    public void diary(Diary diary) {
        this.diary = diary;
        this.clock = diary.getTimeOfFirstEvent();
    }

    public DateTimeStamp getClock() {
        return clock;
    }

    public void setClock(DateTimeStamp newValue) {
        this.clock = newValue;
    }

    public abstract String getName();

Review comment (suggestion):
```suggestion
    private DateTimeStamp clock = new DateTimeStamp(DateTimeStamp.EPOC, 0.0d);
```

Code after:

import com.microsoft.gctoolkit.event.CPUSummary;
import com.microsoft.gctoolkit.event.MemoryPoolSummary;
import com.microsoft.gctoolkit.event.ReferenceGCSummary;
import com.microsoft.gctoolkit.event.jvm.JVMEvent;
import com.microsoft.gctoolkit.event.jvm.MetaspaceRecord;
import com.microsoft.gctoolkit.event.jvm.PermGenSummary;
import com.microsoft.gctoolkit.io.GCLogFile;
import com.microsoft.gctoolkit.jvm.Diary;
import com.microsoft.gctoolkit.message.ChannelName;
import com.microsoft.gctoolkit.message.DataSourceParser;
import com.microsoft.gctoolkit.message.JVMEventChannel;
import com.microsoft.gctoolkit.time.DateTimeStamp;

import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class GCLogParser implements DataSourceParser, SharedPatterns {

    private static final Logger LOGGER = Logger.getLogger(GCLogParser.class.getName());
    public static final String END_OF_DATA_SENTINEL = GCLogFile.END_OF_DATA_SENTINEL;

    public static final GCParseRule GCID_COUNTER = new GCParseRule("GCID_COUNTER", " GC\\((\\d+)\\) ");
    private JVMEventChannel consumer;
    protected Diary diary;
    private DateTimeStamp clock = new DateTimeStamp(DateTimeStamp.EPOC, 0.0d);
    private double lastDuration = 0.0d;


    public GCLogParser() {}

    /**
     * Setting the diary will set the current clock time to the time of the first event
     * in the GC log. This is a better choice than EPOC though EPOC is better than null.
     * @param diary summary the GC log.
     */
    @Override
    public void diary(Diary diary) {
        this.diary = diary;
        this.clock = diary.getTimeOfFirstEvent();
    }

    public DateTimeStamp getClock() {
        return clock;
    }

    public void setClock(DateTimeStamp newValue) {
        this.clock = newValue;
    }

    public abstract String getName();