private static Instant convertToInstant()

in flink-connector-mongodb/src/main/java/org/apache/flink/connector/mongodb/table/converter/BsonToRowDataConverters.java [379:391]


    private static Instant convertToInstant(BsonValue bsonValue) {
        if (bsonValue.isTimestamp()) {
            return Instant.ofEpochSecond(bsonValue.asTimestamp().getTime());
        }
        if (bsonValue.isDateTime()) {
            return Instant.ofEpochMilli(bsonValue.asDateTime().getValue());
        }
        throw new IllegalArgumentException(
                "Unable to convert to Instant from unexpected value '"
                        + bsonValue
                        + "' of type "
                        + bsonValue.getBsonType());
    }