[#btck_set_mock_time]
= btck&lowbar;set&lowbar;mock&lowbar;time
:mrdocs:

Override the current time with a fixed timestamp for testing&period;

== Synopsis

Declared in `&lt;kernel&sol;bitcoinkernel&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
int
btck&lowbar;set&lowbar;mock&lowbar;time(int64&lowbar;t timestamp);
----

== Description

Affects all kernel time reads globally&period; The caller is responsible for gating usage (e&period;g&period; restricting to regtest) if desired&period;

The upper bound (4294967295) matches the maximum value of a block header timestamp&period;

== Return Value

0 on success, non&hyphen;zero if timestamp is outside the valid &lsqb;0, 4294967295&rsqb;range&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *timestamp* [in]
| Unix epoch seconds, or 0 to restore the system clock&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
