Comments (9)
It's working now 😃
from junrar.
DOS times are dependent on timezones.
A DOS time is a packed 16-bit value containing Year (since 1980), Month (1 to 12), Day (1 to 31), hour (0 to 23), minute (0 to 59) and seconds (0 to 58, only even seconds gets stored).
All times in a RAR file are stored as DOS dates. They're therefore timezone dependant, when you're converting them to standard, fixed reference time (like Java's milliseconds since epoch).
See https://codedread.github.io/bitjs/docs/unrar.html#ext-time-structure for more details.
from junrar.
Additional explanation: RAR has a flag to compensate for the missing odd seconds and it also stores sub-seconds time, but it's still a DOS date, although expanded.
from junrar.
The test class with multiple timezones is intentional for testing the constancy of the decoded time under different zones 😉
from junrar.
so that means we can't convert the times to Instant
and expect them to match if the timezone doesn't, correct?
So it might not be a bug, but in that case do you have any idea on what's the best way to compare those dates, when they are being compared across timezones ?
I've got a regression test corpus that store JSON files of all the files in the corpus, and i can check the archive process again against the stored value, however when trying to set it up in Github Actions it fails because the dates are offset by 8.
from junrar.
Or maybe what i need to do is generate the reference data in UTC, and always compare in UTC?
from junrar.
No, we can't expect them to match.
If we know the original timezone, though, we can compare it to the expected instant at that timezone, maybe using a LocalDateTime
or something.
But just an FYI, that was already the case before #76. mTime
was always stored as a DOS date. #76 only added the odd second and sub-seconds parts of it.
It's working as per the specification. We need to change how we compare it in the failing test.
I'd need to take a look at the specific test and see how it's doing it.
from junrar.
I will try to regenerate the data in UTC, and compare in UTC. Easy to do with @DefaultTimeZone("UTC")
.
As of now the data was generated in UTC+8, and the regression test works fine on the same machine, but fails on Github which i suspect is in UTC, which matches with the 8h different i see in the failing assertions.
Thanks for refreshing my memory on the DOS time 😃
from junrar.
Yes, that would work :)
If you want to be thorough, you can generate two JSONs, each on a different time zone, and code two tests with two different time zones :) I think I've done something similar in a test already
from junrar.
Related Issues (20)
- Get a specific inputstream from a rar containing multiple items. HOT 1
- Error unpacking large file(>2G) HOT 10
- Could the junrar project benefit from free security help?
- [BUG] Special characters are not recognized anymore HOT 8
- How to disable logging in System.err? HOT 2
- FileTime.fromMillis(getDateDos(fileTime)) is not working below android API 26 HOT 2
- [BUG]com.github.junrar.exception.UnsupportedRarV5Exception
- CrcErrorException HOT 4
- [BUG] Compress HOT 1
- [BUG]A carefully crafted RAR archive can trigger an infinite loop while parsing. HOT 10
- com.github.junrar.exception.CrcErrorException during extracting of archive HOT 2
- [BUG]A carefully crafted RAR archive can trigger an infinite loop while parsing HOT 21
- [BUG] NullPointerException when extracting solid archives HOT 6
- [BUG]com.github.junrar.exception.CorruptHeaderException: null HOT 2
- [BUG] Exception swallowed during initialization -- silently missing data we used to get in 7.4.1 HOT 11
- [BUG] "IllegalArgumentException: Pipe Size <= 0" with an empty file in the archive HOT 9
- Integration with Google oss-fuzz fuzzing service HOT 2
- Hrlp me HOT 1
- [BUG] Pom License link leads to 404 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from junrar.