diff options
Diffstat (limited to 'unipdf/internal/timeutils/timeutils.go')
| -rw-r--r-- | unipdf/internal/timeutils/timeutils.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/unipdf/internal/timeutils/timeutils.go b/unipdf/internal/timeutils/timeutils.go new file mode 100644 index 0000000..bf69daf --- /dev/null +++ b/unipdf/internal/timeutils/timeutils.go @@ -0,0 +1,19 @@ +// +// 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 (_d "errors";_dc "fmt";_f "regexp";_g "strconv";_dd "time";);func ParsePdfTime (pdfTime string )(_dd .Time ,error ){_fb :=_agb .FindAllStringSubmatch (pdfTime ,1);if len (_fb )< 1{if len (pdfTime )> 0&&pdfTime [0]!='D'{pdfTime =_dc .Sprintf ("\u0044\u003a\u0025\u0073",pdfTime ); +return ParsePdfTime (pdfTime );};return _dd .Time {},_dc .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 (_fb [0])!=10{return _dd .Time {},_d .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"); +};_ag ,_ :=_g .ParseInt (_fb [0][1],10,32);_ae ,_ :=_g .ParseInt (_fb [0][2],10,32);_eg ,_ :=_g .ParseInt (_fb [0][3],10,32);_fbg ,_ :=_g .ParseInt (_fb [0][4],10,32);_ab ,_ :=_g .ParseInt (_fb [0][5],10,32);_b ,_ :=_g .ParseInt (_fb [0][6],10,32);var (_dg byte ; +_cab int64 ;_fc int64 ;);_dg ='+';if len (_fb [0][7])> 0{if _fb [0][7]=="\u002d"{_dg ='-';}else if _fb [0][7]=="\u005a"{_dg ='Z';};};if len (_fb [0][8])> 0{_cab ,_ =_g .ParseInt (_fb [0][8],10,32);}else {_cab =0;};if len (_fb [0][9])> 0{_fc ,_ =_g .ParseInt (_fb [0][9],10,32); +}else {_fc =0;};_gb :=int (_cab *60*60+_fc *60);switch _dg {case '-':_gb =-_gb ;case 'Z':_gb =0;};_ec :=_dc .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_dg ,_cab ,_fc );_de :=_dd .FixedZone (_ec ,_gb );return _dd .Date (int (_ag ),_dd .Month (_ae ),int (_eg ),int (_fbg ),int (_ab ),int (_b ),0,_de ),nil ; +};func FormatPdfTime (in _dd .Time )string {_eb :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_df ,_ :=_g .ParseInt (_eb [1:3],10,32);_gc ,_ :=_g .ParseInt (_eb [4:6],10,32);_gf :=int64 (in .Year ());_a :=int64 (in .Month ());_ed :=int64 (in .Day ()); +_ad :=int64 (in .Hour ());_fa :=int64 (in .Minute ());_gg :=int64 (in .Second ());_c :=_eb [0];return _dc .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",_gf ,_a ,_ed ,_ad ,_fa ,_gg ,_c ,_df ,_gc ); +};var _agb =_f .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"); |
