mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
20 lines
3.0 KiB
Go
20 lines
3.0 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";_e "fmt";_gd "regexp";_g "strconv";_fe "time";);func ParsePdfTime (pdfTime string )(_fe .Time ,error ){_ef :=_efg .FindAllStringSubmatch (pdfTime ,1);if len (_ef )< 1{return _fe .Time {},_e .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 (_ef [0])!=10{return _fe .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");
|
|
};_be ,_ :=_g .ParseInt (_ef [0][1],10,32);_cd ,_ :=_g .ParseInt (_ef [0][2],10,32);_cf ,_ :=_g .ParseInt (_ef [0][3],10,32);_gag ,_ :=_g .ParseInt (_ef [0][4],10,32);_bd ,_ :=_g .ParseInt (_ef [0][5],10,32);_eda ,_ :=_g .ParseInt (_ef [0][6],10,32);var (_fd byte ;
|
|
_cdf int64 ;_gdd int64 ;);if len (_ef [0][7])> 0{_fd =_ef [0][7][0];}else {_fd ='+';};if len (_ef [0][8])> 0{_cdf ,_ =_g .ParseInt (_ef [0][8],10,32);}else {_cdf =0;};if len (_ef [0][9])> 0{_gdd ,_ =_g .ParseInt (_ef [0][9],10,32);}else {_gdd =0;};_fg :=int (_cdf *60*60+_gdd *60);
|
|
switch _fd {case '-':_fg =-_fg ;case 'Z':_fg =0;};_dda :=_e .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_fd ,_cdf ,_gdd );_de :=_fe .FixedZone (_dda ,_fg );return _fe .Date (int (_be ),_fe .Month (_cd ),int (_cf ),int (_gag ),int (_bd ),int (_eda ),0,_de ),nil ;
|
|
};func FormatPdfTime (in _fe .Time )string {_bg :=in .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_d ,_ :=_g .ParseInt (_bg [1:3],10,32);_ed ,_ :=_g .ParseInt (_bg [4:6],10,32);_ga :=int64 (in .Year ());_ge :=int64 (in .Month ());_bc :=int64 (in .Day ());
|
|
_bga :=int64 (in .Hour ());_ee :=int64 (in .Minute ());_c :=int64 (in .Second ());_cc :=_bg [0];return _e .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",_ga ,_ge ,_bc ,_bga ,_ee ,_c ,_cc ,_d ,_ed );
|
|
};var _efg =_gd .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");
|