projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
48767ad
)
Handle std::time::SystemTime as a manually-converted object
author
Matt Corallo
<git@bluematt.me>
Thu, 29 Apr 2021 15:21:04 +0000
(15:21 +0000)
committer
Matt Corallo
<git@bluematt.me>
Thu, 29 Apr 2021 18:59:50 +0000
(18:59 +0000)
c-bindings-gen/src/types.rs
patch
|
blob
|
history
diff --git
a/c-bindings-gen/src/types.rs
b/c-bindings-gen/src/types.rs
index 96ec894f3ee114b91b45ce88ed4e2dc586f8444c..a45cf2b16f7abbb55e3b53f898e1bfdfa379bd39 100644
(file)
--- a/
c-bindings-gen/src/types.rs
+++ b/
c-bindings-gen/src/types.rs
@@
-812,6
+812,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"String" if is_ref => Some("crate::c_types::Str"),
"std::time::Duration" => Some("u64"),
"String" if is_ref => Some("crate::c_types::Str"),
"std::time::Duration" => Some("u64"),
+ "std::time::SystemTime" => Some("u64"),
"std::io::Error" => Some("crate::c_types::IOError"),
"bech32::u5" => Some("crate::c_types::u5"),
"std::io::Error" => Some("crate::c_types::IOError"),
"bech32::u5" => Some("crate::c_types::u5"),
@@
-884,6
+885,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
// cannot create a &String.
"std::time::Duration" => Some("std::time::Duration::from_secs("),
// cannot create a &String.
"std::time::Duration" => Some("std::time::Duration::from_secs("),
+ "std::time::SystemTime" => Some("(::std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs("),
"bech32::u5" => Some(""),
"bech32::u5" => Some(""),
@@
-946,6
+948,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"String" if !is_ref => Some(".into_rust()).unwrap()"),
"std::time::Duration" => Some(")"),
"String" if !is_ref => Some(".into_rust()).unwrap()"),
"std::time::Duration" => Some(")"),
+ "std::time::SystemTime" => Some("))"),
"bech32::u5" => Some(".into()"),
"bech32::u5" => Some(".into()"),
@@
-1023,6
+1026,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"String" => Some(""),
"std::time::Duration" => Some(""),
"String" => Some(""),
"std::time::Duration" => Some(""),
+ "std::time::SystemTime" => Some(""),
"std::io::Error" if !is_ref => Some("crate::c_types::IOError::from_rust("),
"bech32::u5" => Some(""),
"std::io::Error" if !is_ref => Some("crate::c_types::IOError::from_rust("),
"bech32::u5" => Some(""),
@@
-1091,6
+1095,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"String" if is_ref => Some(".as_str().into()"),
"std::time::Duration" => Some(".as_secs()"),
"String" if is_ref => Some(".as_str().into()"),
"std::time::Duration" => Some(".as_secs()"),
+ "std::time::SystemTime" => Some(".duration_since(::std::time::SystemTime::UNIX_EPOCH).expect(\"Times must be post-1970\").as_secs()"),
"std::io::Error" if !is_ref => Some(")"),
"bech32::u5" => Some(".into()"),
"std::io::Error" if !is_ref => Some(")"),
"bech32::u5" => Some(".into()"),