internal unsafe LifeSpan(byte[] buffer)
        {
            fixed(byte *numRef = buffer)
            {
                IntPtr          ptr     = new IntPtr((void *)numRef);
                LifeSpan_Struct struct2 = (LifeSpan_Struct)Marshal.PtrToStructure(ptr, typeof(LifeSpan_Struct));

                this.effectiveTimeUtc = DateTime.FromFileTimeUtc(struct2.start) + (DateTime.UtcNow - DateTime.Now);
                this.expiryTimeUtc    = DateTime.FromFileTimeUtc(struct2.end) + (DateTime.UtcNow - DateTime.Now);
            }
        }
Example #2
0
        internal unsafe LifeSpan(byte[] buffer)
        {
            fixed(byte *pbuffer = &buffer[0])
            {
                IntPtr          ptr      = new IntPtr(pbuffer);
                LifeSpan_Struct lifeSpan = (LifeSpan_Struct)Marshal.PtrToStructure(ptr, typeof(LifeSpan_Struct));

                // start and end times are expressed as local file times.
                // however dateTime.FromFileTime* expects the file time to be in UTC.
                // so we need to add the difference to the DateTime
                this.effectiveTimeUtc = DateTime.FromFileTimeUtc(lifeSpan.start) + (DateTime.UtcNow - DateTime.Now);
                this.expiryTimeUtc    = DateTime.FromFileTimeUtc(lifeSpan.end) + (DateTime.UtcNow - DateTime.Now);
            }
        }