unipdf/internal/timeutils/timeutils.go
2024-04-16 11:40:43 +00:00

20 lines
3.1 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 (_b "errors";_a "fmt";_cg "regexp";_g "strconv";_c "time";);func ParsePdfTime (pdfTime string )(_c .Time ,error ){_gb :=_ddd .FindAllStringSubmatch (pdfTime ,1);if len (_gb )< 1{if len (pdfTime )> 0&&pdfTime [0]!='D'{pdfTime =_a .Sprintf ("\u0044\u003a\u0025\u0073",pdfTime );
return ParsePdfTime (pdfTime );};return _c .Time {},_a .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 (_gb [0])!=10{return _c .Time {},_b .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");
};_f ,_ :=_g .ParseInt (_gb [0][1],10,32);_bd ,_ :=_g .ParseInt (_gb [0][2],10,32);_ee ,_ :=_g .ParseInt (_gb [0][3],10,32);_eeg ,_ :=_g .ParseInt (_gb [0][4],10,32);_gc ,_ :=_g .ParseInt (_gb [0][5],10,32);_acb ,_ :=_g .ParseInt (_gb [0][6],10,32);var (_eb byte ;
_cgd int64 ;_cd int64 ;);_eb ='+';if len (_gb [0][7])> 0{if _gb [0][7]=="\u002d"{_eb ='-';}else if _gb [0][7]=="\u005a"{_eb ='Z';};};if len (_gb [0][8])> 0{_cgd ,_ =_g .ParseInt (_gb [0][8],10,32);}else {_cgd =0;};if len (_gb [0][9])> 0{_cd ,_ =_g .ParseInt (_gb [0][9],10,32);
}else {_cd =0;};_fa :=int (_cgd *60*60+_cd *60);switch _eb {case '-':_fa =-_fa ;case 'Z':_fa =0;};_ag :=_a .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_eb ,_cgd ,_cd );_cga :=_c .FixedZone (_ag ,_fa );return _c .Date (int (_f ),_c .Month (_bd ),int (_ee ),int (_eeg ),int (_gc ),int (_acb ),0,_cga ),nil ;
};var _ddd =_cg .MustCompile ("\u005cs\u002a\u0044\u005cs\u002a\u003a\u005cs\u002a(\\\u0064\u007b\u0034\u007d\u0029\u0028\u005cd\u007b\u0032\u007d\u0029\u0028\u005c\u0064\u007b\u0032\u007d\u0029\u0028\u005c\u0064\u007b\u0032\u007d\u0029\u0028\u005c\u0064\u007b\u0032\u007d\u0029\u0028\u005c\u0064{2\u007d)\u003f\u0028\u005b\u002b\u002d\u005a]\u0029\u003f\u0028\u005c\u0064{\u0032\u007d\u0029\u003f\u0027\u003f\u0028\u005c\u0064\u007b\u0032}\u0029\u003f");
func FormatPdfTime (in _c .Time )string {_ac :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_ca ,_ :=_g .ParseInt (_ac [1:3],10,32);_ce ,_ :=_g .ParseInt (_ac [4:6],10,32);_bgf :=int64 (in .Year ());_ae :=int64 (in .Month ());_ad :=int64 (in .Day ());
_ge :=int64 (in .Hour ());_dd :=int64 (in .Minute ());_gf :=int64 (in .Second ());_af :=_ac [0];return _a .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",_bgf ,_ae ,_ad ,_ge ,_dd ,_gf ,_af ,_ca ,_ce );
};