Skip to content

Commit

Permalink
fixed: displayed time of packets was wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
EricBerendsen committed Aug 11, 2024
1 parent 0105e2e commit 32620ee
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ See the [manual](http://www.digitalekabeltelevisie.nl/dvb_inspector/usermanual.s

List of the most important changes between releases.

### Release 1.19.2 (bug fix release)
Release date: 11/08/2024

* fixed: displayed time of packets was wrong

### Release 1.19.1 (bug fix release)
Release date: 4/08/2024

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>nl.digitalekabeltelevisie</groupId>
<artifactId>DVBinspector</artifactId>
<packaging>jar</packaging>
<version>1.19.1</version>
<version>1.19.2</version>
<description>DVB Inspector is an open-source DVB analyzer, written in java</description>
<name>DVBinspector</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,9 @@ public String getPacketTime(final int packetNo){

}else{
final Calendar now=(Calendar)zeroTime.clone();
now.add(Calendar.MILLISECOND, (int)((packetNo * packetLength * 8 * 1000)/getBitRate()));
// calculation in long, intermediate results can be > Integer.MAX_VALUE
final int timeDiff = (int)(((long)packetNo * packetLength * 8 * 1000)/getBitRate());
now.add(Calendar.MILLISECOND, timeDiff);

r = getFormattedDate(now)+ " "+getFormattedTime(now);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,21 @@ public void packet328081Test() {
assertEquals("continuity_counter",8, packet328081.getContinuityCounter());
assertEquals("file offset",61679228, packet328081.getPacketOffset());
}

@Test
public void testPacketTime(){
assertEquals("PacketTime packet 1","2009/6/30 17h43m54:962",transportStream.getPacketTime(1));
assertEquals("PacketTime packet 123432","2009/6/30 17h44m07:396",transportStream.getPacketTime(123432));
assertEquals("PacketTimepacket 343551","2009/6/30 17h44m29:571",transportStream.getPacketTime(343551));

}

@Test
public void testShortPacketTime(){
assertEquals("ShortPacketTime packet 1","17h43m54:962",transportStream.getShortPacketTime(1));
assertEquals("ShortPacketTime packet 123432","17h44m07:396",transportStream.getShortPacketTime(123432));
assertEquals("ShortPacketTime packet 343551","17h44m29:571",transportStream.getShortPacketTime(343551));

}

}

0 comments on commit 32620ee

Please sign in to comment.