How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

GnuMeric mailing list
Hi
I need to write a timestamp which is relative to 1.1.1601 (windows filetime)
I thought about using gsf_timestamp_set_time() with the different between 1.1.1970 to the previous but my app arc is 32-bit and the different doesn't fit in a 32-bit variable (-11644473600)

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

Morten Welinder-2
GsfTimestamp isn't our best interface, :-/

That said, you really should be able to use gsf_timestamp_set_time for
any time that is actually in the 1970-2038 range.  You'll have to do
the calculation using 64 bit arithmetic, but the final value should be
in range.

M.
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

Morten Welinder-2
Unless you have a specific need for GsfTimestamp, I would recommend
that you use glib's GDateTime type instead.

Morten
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

GnuMeric mailing list
Thank you Morten.

As far as my calculation goes, the difference is -11644473600 which doesn't fit in 32-bit variable, am I wrong?

Regarding GDateTime, any suggestions on how should I use so the property type will be VT_FILETIME?



On Mon, Nov 19, 2018 at 3:34 PM Morten Welinder <[hidden email]> wrote:
Unless you have a specific need for GsfTimestamp, I would recommend
that you use glib's GDateTime type instead.

Morten

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

Morten Welinder-2
> As far as my calculation goes, the difference is -11644473600 which doesn't fit in 32-bit > variable, am I wrong?

It's hard to know without known what date you are trying to represent.
If you really are trying to represent a date back in year 1601 then
you are out of luck.  If, on the other hand, you are trying to
represent a date after 1970 then you should have no problem.

Morten
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

GnuMeric mailing list
Hi
Microsoft Office holds EditTime in minutes starting from 1.1.1601 00:00.
So in case someone worked 4 minutes on a document, the time should show 1.1.1601 00:04.
But I guess I'll have to find another way to represent this.

On Mon, Nov 19, 2018 at 5:52 PM Morten Welinder <[hidden email]> wrote:
> As far as my calculation goes, the difference is -11644473600 which doesn't fit in 32-bit > variable, am I wrong?

It's hard to know without known what date you are trying to represent.
If you really are trying to represent a date back in year 1601 then
you are out of luck.  If, on the other hand, you are trying to
represent a date after 1970 then you should have no problem.

Morten

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: How to use GsfTimestamp for windows timestamp (relative to 1.1.1601)

GnuMeric mailing list
Hi
Is there any example for using GDateTime in a property? (type should still be VT_FILETIME)

On Mon, Nov 19, 2018, 20:11 Sagi Lowenhardt <[hidden email]> wrote:
Hi
Microsoft Office holds EditTime in minutes starting from 1.1.1601 00:00.
So in case someone worked 4 minutes on a document, the time should show 1.1.1601 00:04.
But I guess I'll have to find another way to represent this.

On Mon, Nov 19, 2018 at 5:52 PM Morten Welinder <[hidden email]> wrote:
> As far as my calculation goes, the difference is -11644473600 which doesn't fit in 32-bit > variable, am I wrong?

It's hard to know without known what date you are trying to represent.
If you really are trying to represent a date back in year 1601 then
you are out of luck.  If, on the other hand, you are trying to
represent a date after 1970 then you should have no problem.

Morten

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list