hivex: Add HIVEX_OPEN_WRITE flag to allow hive to be opened for writing.
[libguestfs.git] / hivex / tools / visualizer_NT_time.ml
1 (* Windows Registry reverse-engineering tool.
2  * Copyright (C) 2010 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * For existing information on the registry format, please refer
19  * to the following documents.  Note they are both incomplete
20  * and inaccurate in some respects.
21  *)
22
23 (* Convert an NT file timestamp to time_t.  See:
24  * http://blogs.msdn.com/oldnewthing/archive/2003/09/05/54806.aspx
25  * http://support.microsoft.com/kb/167296
26  *)
27 let nt_to_time_t t =
28   let t = Int64.sub t 116444736000000000L in
29   let t = Int64.div t 10000000L in
30   Int64.to_float t