Publication
Partagez vos connaissances.
Can you get a timestamp when an object is created in Move?
Hey there! I'm working with Move and I'm curious if it's possible to get a timestamp of when an object is created. I've seen something about using sui::clock to capture this, but I was wondering if there's a native way to access this timestamp directly in Move code without additional attributes or if we can avoid additional computations. Any insights?
- Move CLI
- Move
Réponses
2Vous pouvez capturer l'horodatage lors de la création de l'objet en tant qu'attribut en utilisant sui : :clock, comme timestamp_ms. Cette méthode implique l'ajout d'un attribut pour stocker « time_ms » à partir de l'objet Clock partagé.
L'accès aux horodatages directement dans Move, sans ajouter d'attributs, n'est pas pris en charge en soi. La meilleure approche semble être d'utiliser l'objet Clock partagé ou de faire référence aux données de transaction après la création.
Connaissez-vous la réponse ?
Veuillez vous connecter et la partager.