code: func (node *blockNode) CalcPastMedianTime() time.Time {
  	// Create a slice of the previous few block timestamps used to calculate
  	// the median per the number defined by the constant medianTimeBlocks.
  	timestamps := make([]int64, medianTimeBlocks)
  	numNodes := 0
  	iterNode := node
  	for i := 0; i < medianTimeBlocks && iterNode != nil; i++ {
  		timestamps[i] = iterNode.timestamp
  		numNodes++
  
  		iterNode = iterNode.parent
  	}
  
  	// Prune the slice to the actual number of available timestamps which
  	// will be fewer than desired near the beginning of the block chain
  	// and sort them.
  	timestamps = timestamps[:numNodes]
  	sort.Sort(timeSorter(timestamps))
  
  	// NOTE: The consensus rules incorrectly calculate the median for even
  	// numbers of blocks.  A true median averages the middle two elements
  	// for a set with an even number of elements in it.   Since the constant
  	// for the previous number of blocks to be used is odd, this is only an
  	// issue for a few blocks near the beginning of the chain.  I suspect
  	// this is an optimization even though the result is slightly wrong for
  	// a few of the first blocks since after the first few blocks, there
  	// will always be an odd number of blocks in the set per the constant.
  	//
  	// This code follows suit to ensure the same rules are used, however, be
  	// aware that should the medianTimeBlocks constant ever be changed to an
  	// even number, this code will be wrong.
  	medianTimestamp := timestamps[numNodes/2]
  	return time.Unix(medianTimestamp, 0)
  }
docs: // CalcPastMedianTime calculates the median time of the previous few blocks
  // prior to, and including, the block node.
  //
  // This function is safe for concurrent access.