@@ -57,10 +57,8 @@ mod ffi {
5757 /// Returns the date part of the datetime.
5858 fn date ( self : & QDateTime ) -> QDate ;
5959
60- /// Returns the number of days from this datetime to the other datetime.
61- /// The number of days is counted as the number of times midnight is reached between this datetime to the other datetime.
62- /// This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day.
63- #[ rust_name = "days_to" ]
60+ #[ doc( hidden) ]
61+ #[ rust_name = "days_to_qint64" ]
6462 fn daysTo ( self : & QDateTime , other : & QDateTime ) -> qint64 ;
6563
6664 /// Returns if this datetime falls in Daylight-Saving Time.
@@ -79,14 +77,12 @@ mod ffi {
7977 #[ rust_name = "offset_from_utc" ]
8078 fn offsetFromUtc ( self : & QDateTime ) -> i32 ;
8179
82- /// Returns the number of milliseconds from this datetime to the other datetime.
83- /// If the other datetime is earlier than this datetime, the value returned is negative.
84- #[ rust_name = "msecs_to" ]
80+ #[ doc( hidden) ]
81+ #[ rust_name = "msecs_to_qint64" ]
8582 fn msecsTo ( self : & QDateTime , other : & QDateTime ) -> qint64 ;
8683
87- /// Returns the number of seconds from this datetime to the other datetime.
88- /// If the other datetime is earlier than this datetime, the value returned is negative.
89- #[ rust_name = "secs_to" ]
84+ #[ doc( hidden) ]
85+ #[ rust_name = "secs_to_qint64" ]
9086 fn secsTo ( self : & QDateTime , other : & QDateTime ) -> qint64 ;
9187
9288 #[ doc( hidden) ]
@@ -126,16 +122,16 @@ mod ffi {
126122 #[ rust_name = "to_local_time" ]
127123 fn toLocalTime ( self : & QDateTime ) -> QDateTime ;
128124
129- /// Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
130- #[ rust_name = "to_msecs_since_epoch " ]
125+ # [ doc ( hidden ) ]
126+ #[ rust_name = "to_msecs_since_epoch_qint64 " ]
131127 fn toMSecsSinceEpoch ( self : & QDateTime ) -> qint64 ;
132128
133129 /// Returns a copy of this datetime converted to a spec of Qt::OffsetFromUTC with the given offsetSeconds.
134130 #[ rust_name = "to_offset_from_utc" ]
135131 fn toOffsetFromUtc ( self : & QDateTime , offset_seconds : i32 ) -> QDateTime ;
136132
137- /// Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
138- #[ rust_name = "to_secs_since_epoch " ]
133+ # [ doc ( hidden ) ]
134+ #[ rust_name = "to_secs_since_epoch_qint64 " ]
139135 fn toSecsSinceEpoch ( self : & QDateTime ) -> qint64 ;
140136
141137 /// Returns the time as a string. The format parameter determines the format of the string.
@@ -274,13 +270,20 @@ impl QDateTime {
274270
275271 /// Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time.
276272 /// This number is like the POSIX time_t variable, but expressed in milliseconds instead.
277- pub fn current_msecs_since_epoch ( ) -> ffi :: qint64 {
278- ffi:: qdatetime_current_msecs_since_epoch ( )
273+ pub fn current_msecs_since_epoch ( ) -> i64 {
274+ ffi:: qdatetime_current_msecs_since_epoch ( ) . into ( )
279275 }
280276
281277 /// Returns the number of seconds since 1970-01-01T00:00:00 Universal Coordinated Time.
282- pub fn current_secs_since_epoch ( ) -> ffi:: qint64 {
283- ffi:: qdatetime_current_secs_since_epoch ( )
278+ pub fn current_secs_since_epoch ( ) -> i64 {
279+ ffi:: qdatetime_current_secs_since_epoch ( ) . into ( )
280+ }
281+
282+ /// Returns the number of days from this datetime to the other datetime.
283+ /// The number of days is counted as the number of times midnight is reached between this datetime to the other datetime.
284+ /// This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day.
285+ pub fn days_to ( & self , other : & Self ) -> i64 {
286+ self . days_to_qint64 ( other) . into ( )
284287 }
285288
286289 /// Construct a Rust QDateTime from a given QDate, QTime, and QTimeZone
@@ -307,14 +310,14 @@ impl QDateTime {
307310
308311 /// Returns a datetime whose date and time are the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000,
309312 /// Coordinated Universal Time (Qt::UTC) and with the given timeZone.
310- pub fn from_msecs_since_epoch ( msecs : ffi :: qint64 , time_zone : & ffi:: QTimeZone ) -> Self {
311- ffi:: qdatetime_from_msecs_since_epoch ( msecs, time_zone)
313+ pub fn from_msecs_since_epoch ( msecs : i64 , time_zone : & ffi:: QTimeZone ) -> Self {
314+ ffi:: qdatetime_from_msecs_since_epoch ( msecs. into ( ) , time_zone)
312315 }
313316
314317 /// Returns a datetime whose date and time are the number of seconds secs that have passed since 1970-01-01T00:00:00.000,
315318 /// Coordinated Universal Time (Qt::UTC) and converted to the given spec.
316- pub fn from_secs_since_epoch ( secs : ffi :: qint64 , time_zone : & ffi:: QTimeZone ) -> Self {
317- ffi:: qdatetime_from_secs_since_epoch ( secs, time_zone)
319+ pub fn from_secs_since_epoch ( secs : i64 , time_zone : & ffi:: QTimeZone ) -> Self {
320+ ffi:: qdatetime_from_secs_since_epoch ( secs. into ( ) , time_zone)
318321 }
319322
320323 /// Returns the datetime represented in the string as a QDateTime using the format given, or None if this is not possible.
@@ -327,6 +330,18 @@ impl QDateTime {
327330 }
328331 }
329332
333+ /// Returns the number of milliseconds from this datetime to the other datetime.
334+ /// If the other datetime is earlier than this datetime, the value returned is negative.
335+ pub fn msecs_to ( self : & QDateTime , other : & QDateTime ) -> i64 {
336+ self . msecs_to_qint64 ( other) . into ( )
337+ }
338+
339+ /// Returns the number of seconds from this datetime to the other datetime.
340+ /// If the other datetime is earlier than this datetime, the value returned is negative.
341+ pub fn secs_to ( self : & QDateTime , other : & QDateTime ) -> i64 {
342+ self . secs_to_qint64 ( other) . into ( )
343+ }
344+
330345 /// Sets the date part of this datetime to date. If no time is set yet, it is set to midnight.
331346 /// If date is invalid, this QDateTime becomes invalid.
332347 pub fn set_date ( & mut self , date : QDate ) {
@@ -355,6 +370,16 @@ impl QDateTime {
355370 pub fn time_zone ( & self ) -> cxx:: UniquePtr < ffi:: QTimeZone > {
356371 ffi:: qdatetime_time_zone ( self )
357372 }
373+
374+ /// Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
375+ pub fn to_msecs_since_epoch ( self : & QDateTime ) -> i64 {
376+ self . to_msecs_since_epoch_qint64 ( ) . into ( )
377+ }
378+
379+ /// Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
380+ pub fn to_secs_since_epoch ( self : & QDateTime ) -> i64 {
381+ self . to_secs_since_epoch_qint64 ( ) . into ( )
382+ }
358383}
359384
360385impl Clone for QDateTime {
0 commit comments