summaryrefslogtreecommitdiff
path: root/lib/int.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-24 10:41:33 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-24 10:41:33 +0100
commit2ac0d04b5f8571866e729e9d816ea69780892634 (patch)
tree38b4ec7e74c3dceb88726e7b42e18253af2e1a46 /lib/int.h
parentbbfe113c2d7540c6883eb3d83d7052f49f7988fc (diff)
downloadlibtasn1-2ac0d04b5f8571866e729e9d816ea69780892634.tar.gz
libtasn1-2ac0d04b5f8571866e729e9d816ea69780892634.tar.bz2
libtasn1-2ac0d04b5f8571866e729e9d816ea69780892634.zip
some simplifications in time handling
Diffstat (limited to 'lib/int.h')
-rw-r--r--lib/int.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/int.h b/lib/int.h
index 1cd3e66..f1a3f17 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -170,5 +170,21 @@ unsigned int type = ntype & 0xff;
return type;
}
+/* To convert old types from a static structure */
+inline static unsigned int convert_old_type(unsigned int ntype)
+{
+unsigned int type = ntype & 0xff;
+ if (type == ASN1_ETYPE_TIME)
+ {
+ if (type & CONST_UTC)
+ type = ASN1_ETYPE_UTC_TIME;
+ else
+ type = ASN1_ETYPE_GENERALIZED_TIME;
+
+ return type | ((ntype>>8)<<8);
+ }
+ else
+ return ntype;
+}
#endif /* INT_H */