unipdf/internal/timeutils/timeutils.go
2023-10-07 13:58:01 +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 (_cg "errors";_g "fmt";_b "regexp";_ce "strconv";_e "time";);func FormatPdfTime (in _e .Time )string {_bc :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_ea ,_ :=_ce .ParseInt (_bc [1:3],10,32);_a ,_ :=_ce .ParseInt (_bc [4:6],10,32);
_bd :=int64 (in .Year ());_cge :=int64 (in .Month ());_ceb :=int64 (in .Day ());_ed :=int64 (in .Hour ());_fg :=int64 (in .Minute ());_ae :=int64 (in .Second ());_ff :=_bc [0];return _g .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",_bd ,_cge ,_ceb ,_ed ,_fg ,_ae ,_ff ,_ea ,_a );
};var _ec =_b .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");
func ParsePdfTime (pdfTime string )(_e .Time ,error ){_cb :=_ec .FindAllStringSubmatch (pdfTime ,1);if len (_cb )< 1{if len (pdfTime )> 0&&pdfTime [0]!='D'{pdfTime =_g .Sprintf ("\u0044\u003a\u0025\u0073",pdfTime );return ParsePdfTime (pdfTime );};return _e .Time {},_g .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 (_cb [0])!=10{return _e .Time {},_cg .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");
};_d ,_ :=_ce .ParseInt (_cb [0][1],10,32);_ffa ,_ :=_ce .ParseInt (_cb [0][2],10,32);_cef ,_ :=_ce .ParseInt (_cb [0][3],10,32);_eg ,_ :=_ce .ParseInt (_cb [0][4],10,32);_aa ,_ :=_ce .ParseInt (_cb [0][5],10,32);_bb ,_ :=_ce .ParseInt (_cb [0][6],10,32);
var (_fa byte ;_gca int64 ;_fab int64 ;);if len (_cb [0][7])> 0{_fa =_cb [0][7][0];}else {_fa ='+';};if len (_cb [0][8])> 0{_gca ,_ =_ce .ParseInt (_cb [0][8],10,32);}else {_gca =0;};if len (_cb [0][9])> 0{_fab ,_ =_ce .ParseInt (_cb [0][9],10,32);}else {_fab =0;
};_faf :=int (_gca *60*60+_fab *60);switch _fa {case '-':_faf =-_faf ;case 'Z':_faf =0;};_bg :=_g .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_fa ,_gca ,_fab );_eag :=_e .FixedZone (_bg ,_faf );return _e .Date (int (_d ),_e .Month (_ffa ),int (_cef ),int (_eg ),int (_aa ),int (_bb ),0,_eag ),nil ;
};