import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequencer; public class Main { public static void main(String[] argv) throws Exception { Sequencer sequencer = MidiSystem.getSequencer(); sequencer.open(); double seconds = sequencer.getMicrosecondPosition() / 1000000.0; } }