mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
Userland: Add functionality of changing system date in date utility
This commit is contained in:
parent
64c73d0739
commit
b2585b3577
1 changed files with 9 additions and 0 deletions
|
@ -43,6 +43,15 @@ int main(int argc, char** argv)
|
|||
printf("%lld\n", now);
|
||||
return 0;
|
||||
}
|
||||
if (argc == 3 && !strcmp(argv[1], "-s")) {
|
||||
bool ok;
|
||||
timespec ts = { String(argv[2]).to_uint(ok), 0 };
|
||||
if (!ok) {
|
||||
printf("date: Invalid timestamp value\n");
|
||||
return 1;
|
||||
}
|
||||
return clock_settime(CLOCK_REALTIME, &ts);
|
||||
}
|
||||
|
||||
printf("%s\n", Core::DateTime::from_timestamp(now).to_string().characters());
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue