//------------------------------------------------ //--- 010 Editor v4.0 Binary Template // // File: InspectorDates.bt // Authors: SweetScape Software // Version: 1.1 // Purpose: Demonstrates how to add a series of // dates to the Auto Inspector. Includes: // WebkitTime (64-bit int, microseconds since 01/01/1601), // HFSTime (32-bit int, seconds since 01/01/1904), // AppleTime (32-bit int, seconds since 01/01/2001), // PRTime (64-bit int, microseconds since 01/01/1970), // JavaTime (64-bit int, microseconds since 01/01/1970), // GPSTime (32-bit int, seconds since 01/06/1980), // BlackberryDate (32-bit int, minutes since 01/01/1900). // Category: Inspector // File Mask: // ID Bytes: // History: // 1.1 2016-02-12 SweetScape Software: Updated header for repository submission. // 1.0 SweetScape Software: Initial release. //------------------------------------------------ RequiresVersion( 4.0 ); // Calculate the position for each variable, // either at the beginning of the selection // or at the current cursor position. local int64 pos; if( GetSelSize() > 0 ) pos = GetSelStart(); else pos = GetCursorPos(); // Define variables for the inspector FSeek( pos ); byte _si8 ; FSeek( pos ); ubyte _ui8 ; FSeek( pos ); short _si16 ; FSeek( pos ); ushort _ui16 ; FSeek( pos ); int _si32 ; FSeek( pos ); uint _ui32 ; FSeek( pos ); int64 _si64 ; FSeek( pos ); uint64 _ui64 ; FSeek( pos ); float _f ; FSeek( pos ); double _d ; FSeek( pos ); char _s [ReadStringLength(pos,256)] ; // limit to 256 characters FSeek( pos ); wchar_t _ws[ReadWStringLength(pos,256)] ; // limit to 256 characters FSeek( pos ); DOSDATE _dd ; FSeek( pos ); DOSTIME _dt ; FSeek( pos ); time_t _tt ; FSeek( pos ); FILETIME _ft ; FSeek( pos ); OLETIME _ot ; //---------------------------------------------------------------- // WebkitTime // 64-bit integer, number of microseconds since 01/01/1601 00:00:00 typedef uint64 WebkitTime ; FSeek( pos ); WebkitTime _wkt ; string WebkitTimeRead( WebkitTime t ) { // Convert to FILETIME return FileTimeToString( t*10 ); } int WebkitTimeWrite( WebkitTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (int64)ft/10; return result; } //---------------------------------------------------------------- // HFSTime // 32-bit integer, number of seconds since 01/01/1904 00:00:00 typedef uint HFSTime ; FSeek( pos ); HFSTime _hft ; string HFSTimeRead( HFSTime t ) { // Convert to FILETIME return FileTimeToString( t*10000000L + 95616288000000000L ); } int HFSTimeWrite( HFSTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (int)(((uint64)ft - 95616288000000000L)/10000000L); return result; } //---------------------------------------------------------------- // AppleTime // 32-bit integer, number of seconds since 01/01/2001 00:00:00 typedef uint AppleTime ; FSeek( pos ); AppleTime _at ; string AppleTimeRead( AppleTime t ) { // Convert to FILETIME return FileTimeToString( t*10000000L + 126227808000000000L ); } int AppleTimeWrite( AppleTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (int)(((uint64)ft - 126227808000000000L)/10000000L); return result; } //---------------------------------------------------------------- // PRTime // 64-bit integer, number of microseconds since 01/01/1970 00:00:00 typedef uint64 PRTime ; FSeek( pos ); PRTime _prt ; string PRTimeRead( PRTime t ) { // Convert to FILETIME return FileTimeToString( t*10L + 116444736000000000L ); } int PRTimeWrite( PRTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (((uint64)ft - 116444736000000000L)/10L); return result; } //---------------------------------------------------------------- // JavaTime // 64-bit integer, number of microseconds since 01/01/1970 00:00:00 typedef uint64 JavaTime ; FSeek( pos ); JavaTime _jt ; string JavaTimeRead( JavaTime t ) { // Convert to FILETIME return FileTimeToString( t*10000L + 116444736000000000L ); } int JavaTimeWrite( JavaTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (((uint64)ft - 116444736000000000L)/10000L); return result; } //---------------------------------------------------------------- // GPSTime // 32-bit integer, number of seconds since 01/06/1980 00:00:00 typedef uint GPSTime ; FSeek( pos ); GPSTime _gpst ; string GPSTimeRead( GPSTime t ) { // Convert to FILETIME return FileTimeToString( t*10000000L + 119604384000000000 ); } int GPSTimeWrite( GPSTime &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (int)(((uint64)ft - 119604384000000000)/10000000L); return result; } //---------------------------------------------------------------- // BlackberryDate // 32-bit integer, number of minutes since 01/01/1900 00:00:00 typedef uint BlackberryDate ; FSeek( pos ); BlackberryDate _gt ; string BlackberryDateRead( BlackberryDate t ) { // Convert to FILETIME return FileTimeToString( t*600000000L + 94354848000000000L ); } int BlackberryDateWrite( BlackberryDate &t, string value ) { // Convert from FILETIME FILETIME ft; int result = StringToFileTime( value, ft ); t = (int)(((uint64)ft - 94354848000000000L)/600000000L); return result; }