diff --git a/crates/cxx-qt-lib/include/core/qdate.h b/crates/cxx-qt-lib/include/core/qdate.h index ad26d9e1f..75b849258 100644 --- a/crates/cxx-qt-lib/include/core/qdate.h +++ b/crates/cxx-qt-lib/include/core/qdate.h @@ -15,8 +15,6 @@ namespace rust { namespace cxxqtlib1 { -QDate -qdateAddDays(const QDate& date, ::std::int64_t ndays); QDate qdateCurrentDate(); QDate @@ -24,7 +22,7 @@ qdateFromString(const QString& string, const QString& format); QDate qdateFromString(const QString& string, Qt::DateFormat format); // In Qt 5 d is const-ref, in Qt 6 it is value -::std::int64_t +qint64 qdateDaysTo(const QDate& date, QDate d); bool qdateIsLeapYear(::std::int32_t year); diff --git a/crates/cxx-qt-lib/include/core/qdatetime.h b/crates/cxx-qt-lib/include/core/qdatetime.h index 9c0530962..fc4048996 100644 --- a/crates/cxx-qt-lib/include/core/qdatetime.h +++ b/crates/cxx-qt-lib/include/core/qdatetime.h @@ -28,44 +28,24 @@ struct IsRelocatable : ::std::true_type namespace rust { namespace cxxqtlib1 { -QDateTime -qdatetimeAddDays(const QDateTime& datetime, ::std::int64_t ndays); -QDateTime -qdatetimeAddMSecs(const QDateTime& datetime, ::std::int64_t msecs); -QDateTime -qdatetimeAddSecs(const QDateTime& datetime, ::std::int64_t secs); QDateTime qdatetimeCurrentDateTime(); QDateTime qdatetimeCurrentDateTimeUtc(); -::std::int64_t +qint64 qdatetimeCurrentMSecsSinceEpoch(); -::std::int64_t +qint64 qdatetimeCurrentSecsSinceEpoch(); -::std::int64_t -qdatetimeDaysTo(const QDateTime& datetime, const QDateTime& other); QDateTime -qdatetimeFromMSecsSinceEpoch(::std::int64_t msecs, const QTimeZone& timeZone); +qdatetimeFromMSecsSinceEpoch(qint64 msecs, const QTimeZone& timeZone); QDateTime -qdatetimeFromSecsSinceEpoch(::std::int64_t secs, const QTimeZone& timeZone); -::std::int64_t -qdatetimeMSecsTo(const QDateTime& datetime, const QDateTime& other); -::std::int64_t -qdatetimeSecsTo(const QDateTime& datetime, const QDateTime& other); +qdatetimeFromSecsSinceEpoch(qint64 secs, const QTimeZone& timeZone); void qdatetimeSetDate(QDateTime& datetime, QDate date); void -qdatetimeSetMSecsSinceEpoch(QDateTime& datetime, ::std::int64_t msecs); -void -qdatetimeSetSecsSinceEpoch(QDateTime& datetime, ::std::int64_t secs); -void qdatetimeSetTime(QDateTime& datetime, QTime time); ::std::unique_ptr qdatetimeTimeZone(const QDateTime& datetime); -::std::int64_t -qdatetimeToMSecsSinceEpoch(const QDateTime& datetime); -::std::int64_t -qdatetimeToSecsSinceEpoch(const QDateTime& datetime); void qdatetimeSetTimeZone(QDateTime& datetime, const QTimeZone& timeZone); } diff --git a/crates/cxx-qt-lib/src/core/qdate.cpp b/crates/cxx-qt-lib/src/core/qdate.cpp index c5658f404..fc05a6387 100644 --- a/crates/cxx-qt-lib/src/core/qdate.cpp +++ b/crates/cxx-qt-lib/src/core/qdate.cpp @@ -21,23 +21,17 @@ static_assert(::std::is_trivially_copyable::value, namespace rust { namespace cxxqtlib1 { -QDate -qdateAddDays(const QDate& date, ::std::int64_t ndays) -{ - return date.addDays(static_cast(ndays)); -} - QDate qdateCurrentDate() { return QDate::currentDate(); } -::std::int64_t +qint64 qdateDaysTo(const QDate& date, QDate d) { // In Qt 5 d is const-ref, in Qt 6 it is value - return static_cast<::std::int64_t>(date.daysTo(d)); + return date.daysTo(d); } QDate diff --git a/crates/cxx-qt-lib/src/core/qdate.rs b/crates/cxx-qt-lib/src/core/qdate.rs index a07e80dbb..abaacc1ac 100644 --- a/crates/cxx-qt-lib/src/core/qdate.rs +++ b/crates/cxx-qt-lib/src/core/qdate.rs @@ -14,6 +14,12 @@ mod ffi { type DateFormat = crate::DateFormat; } + unsafe extern "C++" { + include!("cxx-qt-lib/qtypes.h"); + #[cxx_name = "qint64"] + type QInt64 = crate::QInt64; + } + unsafe extern "C++" { include!("cxx-qt-lib/qstring.h"); type QString = crate::QString; @@ -21,6 +27,12 @@ mod ffi { include!("cxx-qt-lib/qdate.h"); type QDate = super::QDate; + /// Returns a QDate object containing a date ndays later than the date of this object (or earlier if ndays is negative). + /// + /// Returns a null date if the current date is invalid or the new date is out of range. + #[rust_name = "add_days"] + fn addDays(self: &QDate, ndays: QInt64) -> QDate; + /// Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nmonths is negative). #[rust_name = "add_months"] fn addMonths(self: &QDate, nmonths: i32) -> QDate; @@ -76,17 +88,13 @@ mod ffi { #[namespace = "rust::cxxqtlib1"] unsafe extern "C++" { - #[doc(hidden)] - #[rust_name = "qdate_add_days"] - fn qdateAddDays(date: &QDate, ndays: i64) -> QDate; - #[doc(hidden)] #[rust_name = "qdate_current_date"] fn qdateCurrentDate() -> QDate; #[doc(hidden)] #[rust_name = "qdate_days_to"] - fn qdateDaysTo(date: &QDate, d: QDate) -> i64; + fn qdateDaysTo(date: &QDate, d: QDate) -> QInt64; #[doc(hidden)] #[rust_name = "qdate_from_string"] @@ -147,13 +155,6 @@ impl fmt::Debug for QDate { } impl QDate { - /// Returns a QDate object containing a date ndays later than the date of this object (or earlier if ndays is negative). - /// - /// Returns a null date if the current date is invalid or the new date is out of range. - pub fn add_days(&self, ndays: i64) -> Self { - ffi::qdate_add_days(self, ndays) - } - // Returns the current date, as reported by the system clock. pub fn current_date() -> Self { ffi::qdate_current_date() @@ -162,7 +163,7 @@ impl QDate { /// Returns the number of days from this date to d (which is negative if d is earlier than this date). /// /// Returns 0 if either date is invalid. - pub fn days_to(&self, date: Self) -> i64 { + pub fn days_to(&self, date: Self) -> ffi::QInt64 { ffi::qdate_days_to(self, date) } @@ -271,15 +272,15 @@ mod test { #[test] fn qdate_current_date() { let date_a = QDate::current_date(); - let date_b = date_a.add_days(100); - assert_eq!(date_a.days_to(date_b), 100); + let date_b = date_a.add_days(100.into()); + assert_eq!(i64::from(date_a.days_to(date_b)), 100); } #[test] fn qdate_julian_day() { let date_a = QDate::from_julian_day(1000); let date_b = QDate::from_julian_day(1010); - assert_eq!(date_a.days_to(date_b), 10); + assert_eq!(i64::from(date_a.days_to(date_b)), 10); } #[cfg(feature = "chrono")] diff --git a/crates/cxx-qt-lib/src/core/qdatetime.cpp b/crates/cxx-qt-lib/src/core/qdatetime.cpp index 74ac9c0c7..007ad5223 100644 --- a/crates/cxx-qt-lib/src/core/qdatetime.cpp +++ b/crates/cxx-qt-lib/src/core/qdatetime.cpp @@ -27,24 +27,6 @@ static_assert(QTypeInfo::isRelocatable); namespace rust { namespace cxxqtlib1 { -QDateTime -qdatetimeAddDays(const QDateTime& datetime, ::std::int64_t ndays) -{ - return datetime.addDays(static_cast(ndays)); -} - -QDateTime -qdatetimeAddMSecs(const QDateTime& datetime, ::std::int64_t msecs) -{ - return datetime.addMSecs(static_cast(msecs)); -} - -QDateTime -qdatetimeAddSecs(const QDateTime& datetime, ::std::int64_t secs) -{ - return datetime.addSecs(static_cast(secs)); -} - QDateTime qdatetimeCurrentDateTime() { @@ -57,48 +39,28 @@ qdatetimeCurrentDateTimeUtc() return QDateTime::currentDateTimeUtc(); } -::std::int64_t +qint64 qdatetimeCurrentMSecsSinceEpoch() { return QDateTime::currentMSecsSinceEpoch(); } -::std::int64_t +qint64 qdatetimeCurrentSecsSinceEpoch() { return QDateTime::currentSecsSinceEpoch(); } -::std::int64_t -qdatetimeDaysTo(const QDateTime& datetime, const QDateTime& other) -{ - return static_cast<::std::int64_t>(datetime.daysTo(other)); -} - QDateTime -qdatetimeFromMSecsSinceEpoch(::std::int64_t msecs, const QTimeZone& timeZone) +qdatetimeFromMSecsSinceEpoch(qint64 msecs, const QTimeZone& timeZone) { - return QDateTime::fromMSecsSinceEpoch(static_cast(msecs), timeZone); + return QDateTime::fromMSecsSinceEpoch(msecs, timeZone); } QDateTime -qdatetimeFromSecsSinceEpoch(::std::int64_t secs, const QTimeZone& timeZone) +qdatetimeFromSecsSinceEpoch(qint64 secs, const QTimeZone& timeZone) { - return QDateTime::fromSecsSinceEpoch(static_cast(secs), timeZone); -} - -::std::int64_t -qdatetimeMSecsTo(const QDateTime& datetime, const QDateTime& other) -{ - - return static_cast<::std::int64_t>(datetime.msecsTo(other)); -} - -::std::int64_t -qdatetimeSecsTo(const QDateTime& datetime, const QDateTime& other) -{ - - return static_cast<::std::int64_t>(datetime.secsTo(other)); + return QDateTime::fromSecsSinceEpoch(secs, timeZone); } void @@ -107,18 +69,6 @@ qdatetimeSetDate(QDateTime& datetime, QDate date) datetime.setDate(date); } -void -qdatetimeSetMSecsSinceEpoch(QDateTime& datetime, ::std::int64_t msecs) -{ - datetime.setMSecsSinceEpoch(static_cast(msecs)); -} - -void -qdatetimeSetSecsSinceEpoch(QDateTime& datetime, ::std::int64_t secs) -{ - datetime.setSecsSinceEpoch(static_cast(secs)); -} - void qdatetimeSetTime(QDateTime& datetime, QTime time) { @@ -131,18 +81,6 @@ qdatetimeTimeZone(const QDateTime& datetime) return ::std::make_unique(datetime.timeZone()); } -::std::int64_t -qdatetimeToMSecsSinceEpoch(const QDateTime& datetime) -{ - return static_cast<::std::int64_t>(datetime.toMSecsSinceEpoch()); -} - -::std::int64_t -qdatetimeToSecsSinceEpoch(const QDateTime& datetime) -{ - return static_cast<::std::int64_t>(datetime.toSecsSinceEpoch()); -} - void qdatetimeSetTimeZone(QDateTime& datetime, const QTimeZone& timeZone) { diff --git a/crates/cxx-qt-lib/src/core/qdatetime.rs b/crates/cxx-qt-lib/src/core/qdatetime.rs index 1e2018094..0a85cf424 100644 --- a/crates/cxx-qt-lib/src/core/qdatetime.rs +++ b/crates/cxx-qt-lib/src/core/qdatetime.rs @@ -16,6 +16,12 @@ mod ffi { type TimeSpec = crate::TimeSpec; } + unsafe extern "C++" { + include!("cxx-qt-lib/qtypes.h"); + #[cxx_name = "qint64"] + type QInt64 = crate::QInt64; + } + unsafe extern "C++" { include!("cxx-qt-lib/qdate.h"); type QDate = crate::QDate; @@ -28,10 +34,22 @@ mod ffi { include!("cxx-qt-lib/qtimezone.h"); type QTimeZone = crate::QTimeZone; + /// Returns a QDateTime object containing a datetime ndays days later than the datetime of this object (or earlier if ndays is negative). + #[rust_name = "add_days"] + fn addDays(self: &QDateTime, ndays: QInt64) -> QDateTime; + /// Returns a QDateTime object containing a datetime nmonths months later than the datetime of this object (or earlier if nmonths is negative). #[rust_name = "add_months"] fn addMonths(self: &QDateTime, nmonths: i32) -> QDateTime; + /// Returns a QDateTime object containing a datetime msecs milliseconds later than the datetime of this object (or earlier if msecs is negative). + #[rust_name = "add_msecs"] + fn addMSecs(self: &QDateTime, msecs: QInt64) -> QDateTime; + + /// Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or earlier if s is negative). + #[rust_name = "add_secs"] + fn addSecs(self: &QDateTime, secs: QInt64) -> QDateTime; + /// Returns a QDateTime object containing a datetime nyears years later than the datetime of this object (or earlier if nyears is negative). #[rust_name = "add_years"] fn addYears(self: &QDateTime, nyears: i32) -> QDateTime; @@ -39,6 +57,12 @@ mod ffi { /// Returns the date part of the datetime. fn date(self: &QDateTime) -> QDate; + /// Returns the number of days from this datetime to the other datetime. + /// The number of days is counted as the number of times midnight is reached between this datetime to the other datetime. + /// This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day. + #[rust_name = "days_to"] + fn daysTo(self: &QDateTime, other: &QDateTime) -> QInt64; + /// Returns if this datetime falls in Daylight-Saving Time. #[rust_name = "is_daylight_time"] fn isDaylightTime(self: &QDateTime) -> bool; @@ -55,10 +79,30 @@ mod ffi { #[rust_name = "offset_from_utc"] fn offsetFromUtc(self: &QDateTime) -> i32; + /// Returns the number of milliseconds from this datetime to the other datetime. + /// If the other datetime is earlier than this datetime, the value returned is negative. + #[rust_name = "msecs_to"] + fn msecsTo(self: &QDateTime, other: &QDateTime) -> QInt64; + + /// Returns the number of seconds from this datetime to the other datetime. + /// If the other datetime is earlier than this datetime, the value returned is negative. + #[rust_name = "secs_to"] + fn secsTo(self: &QDateTime, other: &QDateTime) -> QInt64; + + /// Sets the date and time given the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, + /// Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC. + #[rust_name = "set_msecs_since_epoch"] + fn setMSecsSinceEpoch(self: &mut QDateTime, msecs: QInt64); + /// Sets the timeSpec() to Qt::OffsetFromUTC and the offset to offsetSeconds. #[rust_name = "set_offset_from_utc"] fn setOffsetFromUtc(self: &mut QDateTime, offset_seconds: i32); + /// Sets the date and time given the number of seconds secs that have passed since 1970-01-01T00:00:00.000, + /// Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC. + #[rust_name = "set_secs_since_epoch"] + fn setSecsSinceEpoch(self: &mut QDateTime, secs: QInt64); + /// Sets the time specification used in this datetime to spec. The datetime will refer to a different point in time. #[rust_name = "set_time_spec"] fn setTimeSpec(self: &mut QDateTime, spec: TimeSpec); @@ -78,10 +122,18 @@ mod ffi { #[rust_name = "to_local_time"] fn toLocalTime(self: &QDateTime) -> QDateTime; + /// Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). + #[rust_name = "to_msecs_since_epoch"] + fn toMSecsSinceEpoch(self: &QDateTime) -> QInt64; + /// Returns a copy of this datetime converted to a spec of Qt::OffsetFromUTC with the given offsetSeconds. #[rust_name = "to_offset_from_utc"] fn toOffsetFromUtc(self: &QDateTime, offset_seconds: i32) -> QDateTime; + /// Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). + #[rust_name = "to_secs_since_epoch"] + fn toSecsSinceEpoch(self: &QDateTime) -> QInt64; + /// Returns a copy of this datetime converted to the given time spec. #[rust_name = "to_time_spec"] fn toTimeSpec(self: &QDateTime, spec: TimeSpec) -> QDateTime; @@ -97,15 +149,6 @@ mod ffi { #[namespace = "rust::cxxqtlib1"] unsafe extern "C++" { - #[doc(hidden)] - #[rust_name = "qdatetime_add_days"] - fn qdatetimeAddDays(datetime: &QDateTime, ndays: i64) -> QDateTime; - #[doc(hidden)] - #[rust_name = "qdatetime_add_msecs"] - fn qdatetimeAddMSecs(datetime: &QDateTime, msecs: i64) -> QDateTime; - #[doc(hidden)] - #[rust_name = "qdatetime_add_secs"] - fn qdatetimeAddSecs(datetime: &QDateTime, secs: i64) -> QDateTime; #[doc(hidden)] #[rust_name = "qdatetime_current_date_time"] fn qdatetimeCurrentDateTime() -> QDateTime; @@ -114,25 +157,16 @@ mod ffi { fn qdatetimeCurrentDateTimeUtc() -> QDateTime; #[doc(hidden)] #[rust_name = "qdatetime_current_msecs_since_epoch"] - fn qdatetimeCurrentMSecsSinceEpoch() -> i64; + fn qdatetimeCurrentMSecsSinceEpoch() -> QInt64; #[doc(hidden)] #[rust_name = "qdatetime_current_secs_since_epoch"] - fn qdatetimeCurrentSecsSinceEpoch() -> i64; - #[doc(hidden)] - #[rust_name = "qdatetime_days_to"] - fn qdatetimeDaysTo(datetime: &QDateTime, other: &QDateTime) -> i64; + fn qdatetimeCurrentSecsSinceEpoch() -> QInt64; #[doc(hidden)] #[rust_name = "qdatetime_from_msecs_since_epoch"] - fn qdatetimeFromMSecsSinceEpoch(msecs: i64, time_zone: &QTimeZone) -> QDateTime; + fn qdatetimeFromMSecsSinceEpoch(msecs: QInt64, time_zone: &QTimeZone) -> QDateTime; #[doc(hidden)] #[rust_name = "qdatetime_from_secs_since_epoch"] - fn qdatetimeFromSecsSinceEpoch(secs: i64, time_zone: &QTimeZone) -> QDateTime; - #[doc(hidden)] - #[rust_name = "qdatetime_msecs_to"] - fn qdatetimeMSecsTo(datetime: &QDateTime, other: &QDateTime) -> i64; - #[doc(hidden)] - #[rust_name = "qdatetime_secs_to"] - fn qdatetimeSecsTo(datetime: &QDateTime, other: &QDateTime) -> i64; + fn qdatetimeFromSecsSinceEpoch(secs: QInt64, time_zone: &QTimeZone) -> QDateTime; // Note that Qt 5 takes const-ref and Qt 6 takes by-value // for QDateTime::setDate and QDateTime::setTime // @@ -141,23 +175,11 @@ mod ffi { #[rust_name = "qdatetime_set_date"] fn qdatetimeSetDate(datetime: &mut QDateTime, date: QDate); #[doc(hidden)] - #[rust_name = "qdatetime_set_msecs_since_epoch"] - fn qdatetimeSetMSecsSinceEpoch(datetime: &mut QDateTime, msecs: i64); - #[doc(hidden)] - #[rust_name = "qdatetime_set_secs_since_epoch"] - fn qdatetimeSetSecsSinceEpoch(datetime: &mut QDateTime, secs: i64); - #[doc(hidden)] #[rust_name = "qdatetime_set_time"] fn qdatetimeSetTime(datetime: &mut QDateTime, time: QTime); #[doc(hidden)] #[rust_name = "qdatetime_time_zone"] fn qdatetimeTimeZone(datetime: &QDateTime) -> UniquePtr; - #[doc(hidden)] - #[rust_name = "qdatetime_to_msecs_since_epoch"] - fn qdatetimeToMSecsSinceEpoch(datetime: &QDateTime) -> i64; - #[doc(hidden)] - #[rust_name = "qdatetime_to_secs_since_epoch"] - fn qdatetimeToSecsSinceEpoch(datetime: &QDateTime) -> i64; #[rust_name = "qdatetime_settimezone"] fn qdatetimeSetTimeZone(datetime: &mut QDateTime, time_zone: &QTimeZone); } @@ -211,21 +233,6 @@ impl QDateTime { ffi::qdatetime_settimezone(self, time_zone) } - /// Returns a QDateTime object containing a datetime ndays days later than the datetime of this object (or earlier if ndays is negative). - pub fn add_days(&self, ndays: i64) -> Self { - ffi::qdatetime_add_days(self, ndays) - } - - /// Returns a QDateTime object containing a datetime msecs milliseconds later than the datetime of this object (or earlier if msecs is negative). - pub fn add_msecs(&self, msecs: i64) -> Self { - ffi::qdatetime_add_msecs(self, msecs) - } - - /// Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or earlier if s is negative). - pub fn add_secs(&self, secs: i64) -> Self { - ffi::qdatetime_add_secs(self, secs) - } - /// Returns the current datetime, as reported by the system clock, in the local time zone. pub fn current_date_time() -> Self { ffi::qdatetime_current_date_time() @@ -238,22 +245,15 @@ impl QDateTime { /// Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. /// This number is like the POSIX time_t variable, but expressed in milliseconds instead. - pub fn current_msecs_since_epoch() -> i64 { + pub fn current_msecs_since_epoch() -> ffi::QInt64 { ffi::qdatetime_current_msecs_since_epoch() } /// Returns the number of seconds since 1970-01-01T00:00:00 Universal Coordinated Time. - pub fn current_secs_since_epoch() -> i64 { + pub fn current_secs_since_epoch() -> ffi::QInt64 { ffi::qdatetime_current_secs_since_epoch() } - /// Returns the number of days from this datetime to the other datetime. - /// The number of days is counted as the number of times midnight is reached between this datetime to the other datetime. - /// This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day. - pub fn days_to(&self, other: &Self) -> i64 { - ffi::qdatetime_days_to(self, other) - } - /// Construct a Rust QDateTime from a given QDate, QTime, and QTimeZone pub fn from_date_and_time_time_zone( date: &QDate, @@ -275,46 +275,22 @@ impl QDateTime { /// Returns a datetime whose date and time are the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, /// Coordinated Universal Time (Qt::UTC) and with the given timeZone. - pub fn from_msecs_since_epoch(msecs: i64, time_zone: &ffi::QTimeZone) -> Self { + pub fn from_msecs_since_epoch(msecs: ffi::QInt64, time_zone: &ffi::QTimeZone) -> Self { ffi::qdatetime_from_msecs_since_epoch(msecs, time_zone) } /// Returns a datetime whose date and time are the number of seconds secs that have passed since 1970-01-01T00:00:00.000, /// Coordinated Universal Time (Qt::UTC) and converted to the given spec. - pub fn from_secs_since_epoch(secs: i64, time_zone: &ffi::QTimeZone) -> Self { + pub fn from_secs_since_epoch(secs: ffi::QInt64, time_zone: &ffi::QTimeZone) -> Self { ffi::qdatetime_from_secs_since_epoch(secs, time_zone) } - /// Returns the number of milliseconds from this datetime to the other datetime. - /// If the other datetime is earlier than this datetime, the value returned is negative. - pub fn msecs_to(&self, other: &Self) -> i64 { - ffi::qdatetime_msecs_to(self, other) - } - - /// Returns the number of seconds from this datetime to the other datetime. - /// If the other datetime is earlier than this datetime, the value returned is negative. - pub fn secs_to(&self, other: &Self) -> i64 { - ffi::qdatetime_secs_to(self, other) - } - /// Sets the date part of this datetime to date. If no time is set yet, it is set to midnight. /// If date is invalid, this QDateTime becomes invalid. pub fn set_date(&mut self, date: QDate) { ffi::qdatetime_set_date(self, date); } - /// Sets the date and time given the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, - /// Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC. - pub fn set_msecs_since_epoch(&mut self, msecs: i64) { - ffi::qdatetime_set_msecs_since_epoch(self, msecs); - } - - /// Sets the date and time given the number of seconds secs that have passed since 1970-01-01T00:00:00.000, - /// Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC. - pub fn set_secs_since_epoch(&mut self, secs: i64) { - ffi::qdatetime_set_secs_since_epoch(self, secs); - } - /// Sets the time part of this datetime to time. If time is not valid, this function sets it to midnight. /// Therefore, it's possible to clear any set time in a QDateTime by setting it to a default QTime. pub fn set_time(&mut self, time: QTime) { @@ -325,16 +301,6 @@ impl QDateTime { pub fn time_zone(&self) -> cxx::UniquePtr { ffi::qdatetime_time_zone(self) } - - /// Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). - pub fn to_msecs_since_epoch(&self) -> i64 { - ffi::qdatetime_to_msecs_since_epoch(self) - } - - /// Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). - pub fn to_secs_since_epoch(&self) -> i64 { - ffi::qdatetime_to_secs_since_epoch(self) - } } impl Clone for QDateTime {