Code Monkey home page Code Monkey logo

Comments (10)

nikias avatar nikias commented on May 28, 2024

@xdeng have you tested with latest git HEAD? It works correctly for me.

from libplist.

xdeng avatar xdeng commented on May 28, 2024

@nikias The latest version also can not be resolved

You try demo file http://xdeng.cn/file/time2.plist

from libplist.

nikias avatar nikias commented on May 28, 2024

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.

xdeng avatar xdeng commented on May 28, 2024

@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.

xdeng avatar xdeng commented on May 28, 2024

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.

xdeng avatar xdeng commented on May 28, 2024

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.

nikias avatar nikias commented on May 28, 2024

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.

nikias avatar nikias commented on May 28, 2024

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.

xdeng avatar xdeng commented on May 28, 2024

@nikias →_→ You can try try

from libplist.

nikias avatar nikias commented on May 28, 2024

@xdeng try latest code from git HEAD - it will fix it.

from libplist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.