Comments (10)
@xdeng have you tested with latest git HEAD? It works correctly for me.
from libplist.
@nikias The latest version also can not be resolved
You try demo file http://xdeng.cn/file/time2.plist
from libplist.
This is the output I get:
$ plistutil -i time2.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>SDMessageProcessChanges</string>
<string>com.apple.Contacts</string>
<dict>
<key>1</key>
<dict>
<key>last name</key>
<string>小</string>
<key>birthday</key>
<date>1931-02-12T20:00:00Z</date>
<key>com.apple.syncservices.RecordEntityName</key>
<string>com.apple.contacts.Contact</string>
<key>first name</key>
<string>邓</string>
<key>display as company</key>
<string>person</string>
</dict>
</dict>
<true/>
<string>___EmptyParameterString___</string>
</array>
</plist>
Looks correct to me.
from libplist.
@nikias Your machine is 64 bit ????
plist.h 59 line struct timevall long tv_sec; /* seconds */
in my pc, long is 32bit
parse result is different fromf yours.
from libplist.
plist_t plist_new_date(int32_t sec, int32_t usec);
change
plist_t plist_new_date(int64_t sec, int32_t usec); ??????????
from libplist.
in xplist.c 232 line
The Windows version
struct tm *gmtime(
const time_t *timer
);
msdn -> If timer represents a date before midnight, January 1, 1970, gmtime returns NULL.
and mktime
so 1931 year can't parse
from libplist.
I see the problem. Not sure yet how we should solve this across platforms though.
Actually there are two bugs here: 1st is the 32bit vs. 64bit time_t while the other problem is the actual date conversion in windows.
from libplist.
Actually there is also a problem on macOS, mktime (used in xplist.c to parse dates from XML) does not work with dates before ~1900, even though the time_t is 64 bit signed and would easily support that.
I think I will also change the internal storage from struct timeval to double - this is what the binary plist format uses - to get rid of the 32 vs 64 bit storage size difference (and the actual 8 bytes overhead for the plist_data structure in case of 2x64 bit struct timeval size).
Also I found this: https://github.com/evalEmpire/y2038 which would make it work on 32 bit platforms, I tested this on windows and 32-bit linux and it works perfectly.
from libplist.
@nikias →_→ You can try try
from libplist.
@xdeng try latest code from git HEAD - it will fix it.
from libplist.
Related Issues (20)
- Static building multiple undefined reference errors (since 91c0aa8) HOT 2
- Error while loading shared libraries HOT 2
- About the conversion of plist and Objective-C object HOT 3
- Assertion failed: ((node->children->count % 2) == 0), function node_to_xml, file xplist.c, line 365. HOT 1
- `make check -j16` fails due to .out file collisions HOT 3
- Failed to build
- ERROR: Input file is too small to contain valid plist data. HOT 1
- Cython crash when referencing objects after free() is called
- OOB access in `plist_from_memory` HOT 3
- Debian/Ubuntu `libplist-dev` package is outdated HOT 1
- Linker error: ld: archive member '/' not a mach-o file when trying to link libcnary.a HOT 1
- m4/ax_python_devel.m4 is outdated and fails with python 3.12 due to no longer present distutils
- Mistaken issue submission
- Cannot find python in your system PATH
- No autogen.sh in release file HOT 8
- FromBin parse bplist failed!
- ERROR: Input plist data is not compatible with output format.
- [Bug] plistutil cannot read from stdin - ERROR: Could not parse plist data (-3)
- About SIGSEGV (Address boundary error) when using C++ PList::Array
- I found a SEGV on unknown address crash by using AFL++
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 libplist.