Microsoft Windows SYSTEMTIME structure, stores individual components of date and time as individual fields, up to millisecond precision.
This page hosts a formal specification of Microsoft Windows SYSTEMTIME structure using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
All parsing code for Java generated by Kaitai Struct depends on the Java runtime library. You have to install it before you can parse data.
The Java runtime library is published in the Maven Central Repository. Refer to the artifact page for instructions how to add it into your project with the build tool that you use.
Parse a local file and get structure in memory:
WindowsSystemtime data = WindowsSystemtime.fromFile("path/to/local/file.bin");
Or parse structure from a byte array:
byte[] someArray = new byte[] { ... };
WindowsSystemtime data = new WindowsSystemtime(new ByteBufferKaitaiStream(someArray));
After that, one can get various attributes from the structure by invoking getter methods like:
data.year() // => Year
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
import io.kaitai.struct.ByteBufferKaitaiStream;
import io.kaitai.struct.KaitaiStruct;
import io.kaitai.struct.KaitaiStream;
import java.io.IOException;
/**
* Microsoft Windows SYSTEMTIME structure, stores individual components
* of date and time as individual fields, up to millisecond precision.
* @see <a href="https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime">Source</a>
*/
public class WindowsSystemtime extends KaitaiStruct {
public static WindowsSystemtime fromFile(String fileName) throws IOException {
return new WindowsSystemtime(new ByteBufferKaitaiStream(fileName));
}
public WindowsSystemtime(KaitaiStream _io) {
this(_io, null, null);
}
public WindowsSystemtime(KaitaiStream _io, KaitaiStruct _parent) {
this(_io, _parent, null);
}
public WindowsSystemtime(KaitaiStream _io, KaitaiStruct _parent, WindowsSystemtime _root) {
super(_io);
this._parent = _parent;
this._root = _root == null ? this : _root;
_read();
}
private void _read() {
this.year = this._io.readU2le();
this.month = this._io.readU2le();
this.dow = this._io.readU2le();
this.day = this._io.readU2le();
this.hour = this._io.readU2le();
this.min = this._io.readU2le();
this.sec = this._io.readU2le();
this.msec = this._io.readU2le();
}
private int year;
private int month;
private int dow;
private int day;
private int hour;
private int min;
private int sec;
private int msec;
private WindowsSystemtime _root;
private KaitaiStruct _parent;
/**
* Year
*/
public int year() { return year; }
/**
* Month (January = 1)
*/
public int month() { return month; }
/**
* Day of week (Sun = 0)
*/
public int dow() { return dow; }
/**
* Day of month
*/
public int day() { return day; }
/**
* Hours
*/
public int hour() { return hour; }
/**
* Minutes
*/
public int min() { return min; }
/**
* Seconds
*/
public int sec() { return sec; }
/**
* Milliseconds
*/
public int msec() { return msec; }
public WindowsSystemtime _root() { return _root; }
public KaitaiStruct _parent() { return _parent; }
}