forked from WerWolv/ImHex-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
time.pat
62 lines (46 loc) · 1.28 KB
/
time.pat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <std/io.pat>
#include <std/time.pat>
/*!
Types used to decode various different time formats
*/
namespace type {
/**
A 32 bit Unix time value
*/
using time32_t = u32 [[format("type::impl::format_time_t")]];
/**
Alias name for `time32_t`
*/
using time_t = time32_t;
/**
A 64 bit Unix time value
*/
using time64_t = u64 [[format("type::impl::format_time_t")]];
/**
A DOS Date value
*/
using DOSDate = u16 [[format("type::impl::format_dosdate")]];
/**
A DOS Time value
*/
using DOSTime = u16 [[format("type::impl::format_dostime")]];
/**
A 64bit FILETIME value
*/
using FILETIME = u64 [[format("type::impl::format_filetime_as_unix")]];
namespace impl {
fn format_time_t(u128 value) {
return std::time::format(std::time::to_utc(value));
};
fn format_dosdate(u16 value) {
return std::time::format_dos_date(std::time::to_dos_date(value));
};
fn format_dostime(u16 value) {
return std::time::format_dos_time(std::time::to_dos_time(value));
};
fn format_filetime_as_unix(u64 value) {
return std::time::filetime_to_unix(value);
};
}
}