mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Userland: Use Core::DateTime
This commit is contained in:
parent
8f89cc85d1
commit
e22283e5e6
Notes:
sideshowbarker
2024-07-19 09:25:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e22283e5e62
3 changed files with 6 additions and 24 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
@ -37,13 +38,6 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto* tm = localtime(&now);
|
||||
printf("%4u-%02u-%02u %02u:%02u:%02u\n",
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_mon + 1,
|
||||
tm->tm_mday,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
printf("%s\n", Core::DateTime::from_timestamp(now).to_string().characters());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
|
@ -271,14 +272,7 @@ bool print_filesystem_object(const String& path, const String& name, const struc
|
|||
}
|
||||
}
|
||||
|
||||
auto* tm = localtime(&st.st_mtime);
|
||||
printf(" %4u-%02u-%02u %02u:%02u:%02u ",
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_mon + 1,
|
||||
tm->tm_mday,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
printf(" %s ", Core::DateTime::from_timestamp(st.st_mtime).to_string().characters());
|
||||
|
||||
print_name(st, name, path.characters());
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
|
@ -98,14 +99,7 @@ int main(int argc, char** argv)
|
|||
printf(")\n");
|
||||
|
||||
auto print_time = [](time_t t) {
|
||||
auto* tm = localtime(&t);
|
||||
printf("%4u-%02u-%02u %02u:%02u:%02u\n",
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_mon + 1,
|
||||
tm->tm_mday,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
printf("%s\n", Core::DateTime::from_timestamp(t).to_string().characters());
|
||||
};
|
||||
|
||||
printf("Accessed: ");
|
||||
|
|
Loading…
Reference in a new issue