mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
20 lines
3.1 KiB
Go
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";_ce "fmt";_f "regexp";_e "strconv";_cb "time";);func ParsePdfTime (pdfTime string )(_cb .Time ,error ){_db :=_afc .FindAllStringSubmatch (pdfTime ,1);if len (_db )< 1{if len (pdfTime )> 0&&pdfTime [0]!='D'{pdfTime =_ce .Sprintf ("\u0044\u003a\u0025\u0073",pdfTime );
|
|
return ParsePdfTime (pdfTime );};return _cb .Time {},_ce .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 (_db [0])!=10{return _cb .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");
|
|
};_de ,_ :=_e .ParseInt (_db [0][1],10,32);_bf ,_ :=_e .ParseInt (_db [0][2],10,32);_gf ,_ :=_e .ParseInt (_db [0][3],10,32);_gd ,_ :=_e .ParseInt (_db [0][4],10,32);_cfe ,_ :=_e .ParseInt (_db [0][5],10,32);_fe ,_ :=_e .ParseInt (_db [0][6],10,32);var (_dd byte ;
|
|
_fa int64 ;_ae int64 ;);_dd ='+';if len (_db [0][7])> 0{if _db [0][7]=="\u002d"{_dd ='-';}else if _db [0][7]=="\u005a"{_dd ='Z';};};if len (_db [0][8])> 0{_fa ,_ =_e .ParseInt (_db [0][8],10,32);}else {_fa =0;};if len (_db [0][9])> 0{_ae ,_ =_e .ParseInt (_db [0][9],10,32);
|
|
}else {_ae =0;};_bc :=int (_fa *60*60+_ae *60);switch _dd {case '-':_bc =-_bc ;case 'Z':_bc =0;};_gdg :=_ce .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_dd ,_fa ,_ae );_ab :=_cb .FixedZone (_gdg ,_bc );return _cb .Date (int (_de ),_cb .Month (_bf ),int (_gf ),int (_gd ),int (_cfe ),int (_fe ),0,_ab ),nil ;
|
|
};func FormatPdfTime (in _cb .Time )string {_d :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_cf ,_ :=_e .ParseInt (_d [1:3],10,32);_ea ,_ :=_e .ParseInt (_d [4:6],10,32);_a :=int64 (in .Year ());_fb :=int64 (in .Month ());_fg :=int64 (in .Day ());
|
|
_bd :=int64 (in .Hour ());_gb :=int64 (in .Minute ());_cc :=int64 (in .Second ());_af :=_d [0];return _ce .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",_a ,_fb ,_fg ,_bd ,_gb ,_cc ,_af ,_cf ,_ea );
|
|
};var _afc =_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");
|