Repository: CosmWasm/cosmwasm (rust)

Issue:
Move Timestamp to cosmwasm-core
After #2098

Timestamp is a very common type like Addr and Uint128 that users likely want in other environments too

Pull request description:
Move Timestamp to cosmwasm-core
closes #2100 

Patch:
diff --git a/packages/core/src/lib.rs b/packages/core/src/lib.rs
index faed6f21c..d538a8779 100644
--- a/packages/core/src/lib.rs
+++ b/packages/core/src/lib.rs
@@ -17,6 +17,7 @@ mod errors;
 mod forward_ref;
 mod hex_binary;
 mod math;
+mod timestamp;
 
 #[doc(hidden)]
 pub mod __internal;
@@ -38,6 +39,7 @@ pub use crate::math::{
     Int512, Int64, Isqrt, SignedDecimal, SignedDecimal256, SignedDecimal256RangeExceeded,
     SignedDecimalRangeExceeded, Uint128, Uint256, Uint512, Uint64,
 };
+pub use crate::timestamp::Timestamp;
 
 /// Exposed for testing only
 /// Both unit tests and integration tests are compiled to native code, so everything in here does not need to compile to Wasm.
diff --git a/packages/std/src/timestamp.rs b/packages/core/src/timestamp.rs
similarity index 98%
rename from packages/std/src/timestamp.rs
rename to packages/core/src/timestamp.rs
index 53449cbe3..837b97698 100644
--- a/packages/std/src/timestamp.rs
+++ b/packages/core/src/timestamp.rs
@@ -1,8 +1,8 @@
 use core::fmt;
-use cosmwasm_core::Uint64;
-use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
+use crate::Uint64;
+
 /// A point in time in nanosecond precision.
 ///
 /// This type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.
@@ -21,9 +21,8 @@ use serde::{Deserialize, Serialize};
 /// assert_eq!(ts.seconds(), 3);
 /// assert_eq!(ts.subsec_nanos(), 202);
 /// ```
-#[derive(
-    Serialize, Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, JsonSchema,
-)]
+#[derive(Serialize, Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)]
+#[cfg_attr(feature = "std", derive(schemars::JsonSchema))]
 pub struct Timestamp(Uint64);
 
 impl Timestamp {
diff --git a/packages/std/src/ibc.rs b/packages/std/src/ibc.rs
index 21fa941ad..29c3c3bf4 100644
--- a/packages/std/src/ibc.rs
+++ b/packages/std/src/ibc.rs
@@ -2,14 +2,13 @@
 // The rest of the IBC related functionality is defined here
 
 use core::cmp::{Ord, Ordering, PartialOrd};
-use cosmwasm_core::Addr;
+use cosmwasm_core::{Addr, Timestamp};
 use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
 use crate::coin::Coin;
 use crate::prelude::*;
 use crate::results::{Attribute, CosmosMsg, Empty, Event, SubMsg};
-use crate::timestamp::Timestamp;
 use crate::StdResult;
 use crate::{to_json_binary, Binary};
 
diff --git a/packages/std/src/lib.rs b/packages/std/src/lib.rs
index 3cfd30893..6860b9bc0 100644
--- a/packages/std/src/lib.rs
+++ b/packages/std/src/lib.rs
@@ -23,7 +23,6 @@ mod sections;
 mod serde;
 mod stdack;
 mod storage;
-mod timestamp;
 mod traits;
 mod types;
 
@@ -78,7 +77,6 @@ pub use crate::serde::{
 };
 pub use crate::stdack::StdAck;
 pub use crate::storage::MemoryStorage;
-pub use crate::timestamp::Timestamp;
 pub use crate::traits::{Api, Querier, QuerierResult, QuerierWrapper, Storage};
 pub use crate::types::{BlockInfo, ContractInfo, Env, MessageInfo, TransactionInfo};
 
@@ -117,8 +115,8 @@ pub use cosmwasm_core::{
     Decimal256RangeExceeded, DecimalRangeExceeded, DivideByZeroError, DivisionError, Fraction,
     HexBinary, Instantiate2AddressError, Int128, Int256, Int512, Int64, Isqrt, OverflowError,
     OverflowOperation, RecoverPubkeyError, SignedDecimal, SignedDecimal256,
-    SignedDecimal256RangeExceeded, SignedDecimalRangeExceeded, SystemError, Uint128, Uint256,
-    Uint512, Uint64, VerificationError,
+    SignedDecimal256RangeExceeded, SignedDecimalRangeExceeded, SystemError, Timestamp, Uint128,
+    Uint256, Uint512, Uint64, VerificationError,
 };
 
 #[cfg(not(target_arch = "wasm32"))]
diff --git a/packages/std/src/types.rs b/packages/std/src/types.rs
index 654da76da..b2a20ec27 100644
--- a/packages/std/src/types.rs
+++ b/packages/std/src/types.rs
@@ -1,10 +1,9 @@
-use cosmwasm_core::Addr;
+use cosmwasm_core::{Addr, Timestamp};
 use schemars::JsonSchema;
 use serde::{Deserialize, Serialize};
 
 use crate::coin::Coin;
 use crate::prelude::*;
-use crate::timestamp::Timestamp;
 
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
 pub struct Env {


Test patch:
diff --git a/packages/std/src/testing/mock.rs b/packages/std/src/testing/mock.rs
index c03bd03b6..bf83a3a6b 100644
--- a/packages/std/src/testing/mock.rs
+++ b/packages/std/src/testing/mock.rs
@@ -7,7 +7,7 @@ use bech32::{encode, Bech32, Hrp};
 use core::marker::PhantomData;
 #[cfg(feature = "cosmwasm_1_3")]
 use core::ops::Bound;
-use cosmwasm_core::{Addr, CanonicalAddr};
+use cosmwasm_core::{Addr, CanonicalAddr, Timestamp};
 use rand_core::OsRng;
 use serde::de::DeserializeOwned;
 #[cfg(feature = "stargate")]
@@ -36,7 +36,6 @@ use crate::query::{
 use crate::query::{DelegatorWithdrawAddressResponse, DistributionQuery};
 use crate::results::{ContractResult, Empty, SystemResult};
 use crate::storage::MemoryStorage;
-use crate::timestamp::Timestamp;
 use crate::traits::{Api, Querier, QuerierResult};
 use crate::types::{BlockInfo, ContractInfo, Env, MessageInfo, TransactionInfo};
 use crate::{from_json, to_json_binary, Binary, Uint128};