File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
pg/src/test/java/org/bouncycastle/openpgp/test Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1010import org .bouncycastle .openpgp .operator .jcajce .JcaPGPKeyPair ;
1111
1212import java .security .KeyPair ;
13+ import java .text .ParseException ;
14+ import java .text .SimpleDateFormat ;
1315import java .util .Date ;
16+ import java .util .TimeZone ;
1417
1518public abstract class AbstractPgpKeyPairTest
1619 extends AbstractPacketTest
1720{
1821
22+ public static Date parseUTCTimestamp (String timestamp )
23+ {
24+ // Not thread safe, so we use a local variable
25+ SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss z" );
26+ dateFormat .setTimeZone (TimeZone .getTimeZone ("UTC" ));
27+ try
28+ {
29+ return dateFormat .parse (timestamp );
30+ }
31+ catch (ParseException e )
32+ {
33+ throw new RuntimeException (e );
34+ }
35+ }
36+
1937 public Date currentTimeRounded ()
2038 {
2139 Date now = new Date ();
You can’t perform that action at this time.
0 commit comments