unipdf/internal/timeutils/timeutils.go
2024-11-22 00:42: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";_g "fmt";_cf "regexp";_c "strconv";_a "time";);var _ff =_cf .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 _a .Time )string {_e :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_bd ,_ :=_c .ParseInt (_e [1:3],10,32);_bff ,_ :=_c .ParseInt (_e [4:6],10,32);_d :=int64 (in .Year ());_cb :=int64 (in .Month ());_de :=int64 (in .Day ());
_ed :=int64 (in .Hour ());_beg :=int64 (in .Minute ());_fe :=int64 (in .Second ());_gb :=_e [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",_d ,_cb ,_de ,_ed ,_beg ,_fe ,_gb ,_bd ,_bff );
};func ParsePdfTime (pdfTime string )(_a .Time ,error ){_aa :=_ff .FindAllStringSubmatch (pdfTime ,1);if len (_aa )< 1{if len (pdfTime )> 0&&pdfTime [0]!='D'{pdfTime =_g .Sprintf ("\u0044\u003a\u0025\u0073",pdfTime );return ParsePdfTime (pdfTime );};return _a .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 (_aa [0])!=10{return _a .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");
};_ea ,_ :=_c .ParseInt (_aa [0][1],10,32);_ge ,_ :=_c .ParseInt (_aa [0][2],10,32);_ac ,_ :=_c .ParseInt (_aa [0][3],10,32);_af ,_ :=_c .ParseInt (_aa [0][4],10,32);_ba ,_ :=_c .ParseInt (_aa [0][5],10,32);_bag ,_ :=_c .ParseInt (_aa [0][6],10,32);var (_dd byte ;
_dg int64 ;_bed int64 ;);_dd ='+';if len (_aa [0][7])> 0{if _aa [0][7]=="\u002d"{_dd ='-';}else if _aa [0][7]=="\u005a"{_dd ='Z';};};if len (_aa [0][8])> 0{_dg ,_ =_c .ParseInt (_aa [0][8],10,32);}else {_dg =0;};if len (_aa [0][9])> 0{_bed ,_ =_c .ParseInt (_aa [0][9],10,32);
}else {_bed =0;};_gc :=int (_dg *60*60+_bed *60);switch _dd {case '-':_gc =-_gc ;case 'Z':_gc =0;};_aad :=_g .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_dd ,_dg ,_bed );_dc :=_a .FixedZone (_aad ,_gc );return _a .Date (int (_ea ),_a .Month (_ge ),int (_ac ),int (_af ),int (_ba ),int (_bag ),0,_dc ),nil ;
};