Skip to content

Commit

Permalink
Changes to force TZ to UTC #75 (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Apr 19, 2021
1 parent 96e9059 commit eeb7b69
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion class_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
DEBUG = 0

# The pytsk3 version.
VERSION = "20210327"
VERSION = "20210419"

# These functions are used to manage library memory.
FREE = "aff4_free"
Expand Down
4 changes: 2 additions & 2 deletions dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytsk3 (20210327-1) unstable; urgency=low
pytsk3 (20210419-1) unstable; urgency=low

* Auto-generated

-- Joachim Metz <[email protected]> Sat, 27 Mar 2021 13:12:25 -0100
-- Joachim Metz <[email protected]> Mon, 19 Apr 2021 20:05:49 -0100
21 changes: 20 additions & 1 deletion tsk3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "tsk3.h"

#include <time.h>

#if defined( TSK_MULTITHREAD_LIB )

extern "C" {
extern void tsk_init_lock(tsk_lock_t * lock);
extern void tsk_deinit_lock(tsk_lock_t * lock);
}
#endif

#endif /* defined( TSK_MULTITHREAD_LIB ) */

/* Prototypes for IMG_INFO hooks
* Note that IMG_INFO_read is called by the SleuthKit the Img_Info_read
Expand Down Expand Up @@ -690,6 +695,20 @@ VIRTUAL(Volume_Info, Object) {


void tsk_init() {

// libtsk uses mktime and localtime that rely on the TZ environment variable
// however that leads to inconsistent behavior with different TZ values.
// Hence that we force TZ to be UTC, when possible.
#if defined( _MSC_VER )
_putenv_s("TZ", "UTC");
_tzset();

// Some installations of MinGW do not support setenv
#elif !defined( __MINGW32__ )
setenv("TZ", "UTC", 1);
tzset();
#endif

//tsk_verbose++;
Img_Info_init((Object)&__Img_Info);
FS_Info_init((Object)&__FS_Info);
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20210327
20210419

0 comments on commit eeb7b69

Please sign in to comment.