unipdf/internal/timeutils/timeutils.go
2022-03-13 12:41:53 +00:00

20 lines
2.9 KiB
Go

//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
package timeutils ;import (_db "errors";_dg "fmt";_g "regexp";_bd "strconv";_b "time";);func ParsePdfTime (pdfTime string )(_b .Time ,error ){_a :=_ed .FindAllStringSubmatch (pdfTime ,1);if len (_a )< 1{return _b .Time {},_dg .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0064\u0061\u0074\u0065\u0020s\u0074\u0072\u0069\u006e\u0067\u0020\u0028\u0025\u0073\u0029",pdfTime );
};if len (_a [0])!=10{return _b .Time {},_db .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0065\u0067\u0065\u0078p\u0020\u0067\u0072\u006f\u0075\u0070 \u006d\u0061\u0074\u0063\u0068\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020!\u003d\u0020\u0031\u0030");
};_ab ,_ :=_bd .ParseInt (_a [0][1],10,32);_ee ,_ :=_bd .ParseInt (_a [0][2],10,32);_ca ,_ :=_bd .ParseInt (_a [0][3],10,32);_be ,_ :=_bd .ParseInt (_a [0][4],10,32);_bdf ,_ :=_bd .ParseInt (_a [0][5],10,32);_bbg ,_ :=_bd .ParseInt (_a [0][6],10,32);var (_eb byte ;
_ae int64 ;_eg int64 ;);if len (_a [0][7])> 0{_eb =_a [0][7][0];}else {_eb ='+';};if len (_a [0][8])> 0{_ae ,_ =_bd .ParseInt (_a [0][8],10,32);}else {_ae =0;};if len (_a [0][9])> 0{_eg ,_ =_bd .ParseInt (_a [0][9],10,32);}else {_eg =0;};_gfg :=int (_ae *60*60+_eg *60);
switch _eb {case '-':_gfg =-_gfg ;case 'Z':_gfg =0;};_fg :=_dg .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_eb ,_ae ,_eg );_efd :=_b .FixedZone (_fg ,_gfg );return _b .Date (int (_ab ),_b .Month (_ee ),int (_ca ),int (_be ),int (_bdf ),int (_bbg ),0,_efd ),nil ;
};func FormatPdfTime (in _b .Time )string {_f :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_c ,_ :=_bd .ParseInt (_f [1:3],10,32);_gf ,_ :=_bd .ParseInt (_f [4:6],10,32);_bf :=int64 (in .Year ());_e :=int64 (in .Month ());_de :=int64 (in .Day ());
_ef :=int64 (in .Hour ());_da :=int64 (in .Minute ());_ga :=int64 (in .Second ());_gb :=_f [0];return _dg .Sprintf ("\u0044\u003a\u0025\u002e\u0034\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e2\u0064\u0025\u0063\u0025\u002e2\u0064\u0027%\u002e\u0032\u0064\u0027",_bf ,_e ,_de ,_ef ,_da ,_ga ,_gb ,_c ,_gf );
};var _ed =_g .MustCompile ("\u005c\u0073\u002a\u0044\u005c\u0073\u002a:\u005c\u0073\u002a\u0028\u005c\u0064\u007b\u0034\u007d\u0029\u0028\u005c\u0064\u007b2\u007d)\u0028\u005c\u0064\u007b\u0032\u007d)\u0028\u005c\u0064\u007b\u0032\u007d\u0029(\u005c\u0064\u007b\u0032\u007d\u0029\u0028\u005c\u0064\u007b\u0032\u007d\u0029\u0028\u005b\u002b\u002d\u005a\u005d\u0029\u003f\u0028\u005cd\u007b\u0032\u007d\u0029\u003f\u0027\u003f\u0028\u005c\u0064\u007b\u0032\u007d)\u003f");